Author Message
AdiletKabylbekov
Joined: Nov 13, 2013
Messages: 12
Offline
Hi, EveryBody

I have a case with use web service in dialog designer app.

Need to send request message like:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.huawei.com/bss/esb/xsd/en/1.0" xmlns:ns1="http://www.huawei.com/bss/esb/xsd/common/1.0">
<soapenv:Header/>
<soapenv:Body>
<ns:IVRQueryBalanceRequest>
<ns:RequestHeader>
<ns1:RequestHeader>
<!--Optional:-->
<ns1:TenantID>101</ns1:TenantID>
<!--Optional:-->
<ns1:SerialNo>1</ns1:SerialNo>
<!--Optional:-->
<!--Optional:-->
</ns1:RequestHeader>
</ns:RequestHeader>
<ns:RequestBody>
<ns:MSISDN>996777174033</ns:MSISDN>
</ns:RequestBody>
</ns:IVRQueryBalanceRequest>
</soapenv:Body>
</soapenv:Envelope>


and so i wil have got below response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<NS1:IVRQueryBalanceResponse xmlns:NS1="http://www.huawei.com/bss/esb/xsd/en/1.0">
<NS1:ResponseHeader>
<NS2:ResponseHeader xmlns:NS2="http://www.huawei.com/bss/esb/xsd/common/1.0">
<NS2:SerialNo>1</NS2:SerialNo>
<NS2:ResultCode>0</NS2:ResultCode>
<NS2:ResultDesc>Operation is success</NS2:ResultDesc>
<NS2:OperationTime>14-11-2013 11:04:41</NS2:OperationTime>
<NS2:TenantID>101</NS2:TenantID>
</NS2:ResponseHeader>
</NS1:ResponseHeader>
<NS1:ResponseBody>
<NS1:subtype>01</NS1:subtype>
<NS1:lifecyclestatus>1</NS1:lifecyclestatus>
<NS1:Balance>60.00</NS1:Balance>
</NS1:ResponseBody>
</NS1:IVRQueryBalanceResponse>
</soapenv:Body>
</soapenv:Envelope>


For RequestBody parametrs i can input some values with DD complex variables and can get values for Responsebody also:
example: RequestBody:MSISDN

Bur for RequestHeader and fro ResponseHeade i can't set complex values with DD.


In DevGuide of OD i red that i can use Java object for WS variables:
Indicates whether the content of the variable should be treated as a Java object to prevent Orchestration Designer from mapping it.
Use this option when the structure of the data to be sent to the Web service is more complex than what can be contained within a normal variable.
When using this option, subsequently, the following steps must be taken:
Create the Java object and storing it in the variable, if sending the object to the Web service.
Write the required Java code by overriding an existing method, such as the following method:
requestBegin ( SCESession mySession )
Retrieve the Java object from the variable, if receiving the object from the Web service.



but i can't understand how it is realised.

Can anybody Help me?
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Creating Java objects isn't as difficult as it sounds, but if this is your first time doing so it can seem daunting. The process is relatively straightforward.

For the request object:

1. Create Java request object
2. Set values within the object
3. Store the object into an OD variable
4. Let OD make the web service call using the WSOP

For the response object:

1. Retrieve the Java object from the OD variable
2. Get values from within the object
3. Set those values into other OD variables to be used in the Callflow
4. Continue with the OD app flow

Without knowing the specifics of the connection you need to make, I can only provide a general way this code can look. In the Devguide, it mentions to use the requestBegin method, but you can also create a Java Servlet in your flow to house the code. You would have one servlet before the Data node that calls the web service, and one servlet after the Data node. The one before sets request data, the one after retrieves response data.

The below code is taken from an example I provided for another customer.

Request sample Java:

public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {


// Create the request object
GetEquipmentInfo request = new GetEquipmentInfo();

/* Set values in the request object.
* Typically this involves invoking "setter" methods, that is methods
* that begin with the word "set". Below, this is setEquipmentNumber.*/
request.setEquipmentNumber(0);

/* Set the request object into an OD variable
* The class IProjectVariables contains all OD variables, or you can
* type the variable name in as a text string.
*/
mySession.getVariable(IProjectVariables.REQUEST).getSimpleVariable().setValue(request);

// The web service call will now be made using the stored Java objects
}


Response sample Java:

public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {


// Get the response object
GetEquipmentInfoResponse response = (GetEquipmentInfoResponse) mySession.getVariableField(IProjectVariables.RETURN_1).getObjectValue();
EquipmentInfo info = response.get_return();

/* Get the individual values from the response object
* Just like you set values using "setter" methods, you access
* values using "getter" methods.
*/
long num = info.getEquipmentNumber();
String msg = info.getErrorMessage();
String language = info.getLanguage();
String sapNum = info.getSapEquipmentNumber();
String serial = info.getSerialNumber();

// Set those values into OD variables
mySession.getVariableField(IProjectVariables.RETURN_1_FIELD_EQUIPMENT_NUMBER).setValue(num);
mySession.getVariableField(IProjectVariables.RETURN_1_FIELD_ERROR_MESSAGE).setValue(msg);
mySession.getVariableField(IProjectVariables.RETURN_1_FIELD_LANGUAGE).setValue(language);
mySession.getVariableField(IProjectVariables.RETURN_1_FIELD_SAP_EQUIPMENT_NUMBER).setValue(sapNum);
mySession.getVariableField(IProjectVariables.RETURN_1_FIELD_SERIAL_NUMBER).setValue(serial);
}


If you are not used to writing Java code, I would suggest looking at examples in the various developer guides available here, as well as using the web for more general Java questions.
AdiletKabylbekov
Joined: Nov 13, 2013
Messages: 12
Offline
Hi,
thank you for hep, but i used another way with SAAJ API,
anyway thank's :))

i have another problem:

i uploaded to tomcat library javax.xml.soap_1.3.0.jar, and include this jar into my project libraries, even so tomcat using axis lib axis2-saaj-1.5.jar, but with using this library i have problems with definition SOAPACTION.
WHY?

I deleted the axis2-saaj-1.5.jar from tomcat lib, and
everything work without any problems.


Is That ok if i deleted axis2-saaj-1.5.jar? I mean, don't DD or EP system lybriries use this jar? Is this jar used only by developer webservice?
Go to:   
Mobile view