Author Message
jmercenier
Joined: Nov 5, 2013
Messages: 1
Offline
Hello, we call a WS with a Axis 2 nodes that returns the following XML structure:


<?xml version='1.0' encoding='utf-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getEquipmentInfoResponse xmlns:ns2="http://ws.krms.com/">
<return>
<equipmentNumber>10000001</equipmentNumber>
<sapEquipmentNumber>000000000010000001</sapEquipmentNumber>
<serialNumber>0000007</serialNumber>
</return>
</ns2:getEquipmentInfoResponse>
</S:Body>
</S:Envelope>


We created a complex variable with 3 fields with the same name and assigned it as output variable. But everything is messed up in the variables !


05/11/2013 16:51:59 DEBUG - 3CCBCA596E4ACC025B6C9BFB98D27DEB:/AlarmTest : Storing [000000000010000001] to: GetEquipmentInfoResponse:equipmentNumber
05/11/2013 16:51:59 DEBUG - 3CCBCA596E4ACC025B6C9BFB98D27DEB:/AlarmTest : Storing [0000007] to: GetEquipmentInfoResponse:sapEquipmentNumber
05/11/2013 16:51:59 DEBUG - 3CCBCA596E4ACC025B6C9BFB98D27DEB:/AlarmTest : Storing [0000007] to: GetEquipmentInfoResponse:serialNumber


When we look at the java code we don't see how it's suppose to work as it seems there is no real mapping between the xml fields and the variable fields.
Are we suppose to create custom java objects ? If yes, have you got a simple example ?

Bye,
Julien
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
The mapping of OD variables to response values from the web service is done primarily via the WSOP wizard or the WSOP editor. When you go through the wizard, the last two pages let you specify what OD variable you wish to use and the web service values for which each variable should be used. The web service connector then maps response values internally, like the ones in the XML, to the OD vars that are defined in the WSOP editor. You can confirm this by opening up the WSOP editor and checking out how the variables are being used. The Output Parameter section will have Parameter Name, Parameter Type, and then the OD variable and field (if any). If the Use Java Object box is checked, then yes you will probably have to write Java code to get the values.

For your issue, it doesn't look like you need to write Java code, since the returned XML seems simple enough. There is some weirdness with how the variables are being used, however. When you say that you looked at the Java code, which code are you talking about? The files in WEB-INF/src/connectivity.ws.beans? WEB-INF/src/connectivity.ws.operations? Somewhere else? Did you modify the Java code directly?

Lastly, go ahead and post your WSDL here and I can try and create the WSOP myself to see what happens. We have this new forum now, and you can actually attach the WSDL file by clicking the Attachments option (hopefully that option is available to you?), rather than copy/pasting the WSDL text.
Anonymous

Thank's for your answer SamareshKowshik.
The java codes are the files in WEB-INF/src/connectivity.ws.operations.

It's seems that the java code in WEB-INF/src/connectivity.ws.operations associated to the wsop2 file is incomplete.

Here is the wsdl, with the xml file associated.




<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.krms.kone.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.krms.kone.com/" name="EquipmentWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.krms.kone.com/" schemaLocation="equipment-service.xml"></xsd:import>
</xsd:schema>
</types>
<message name="getEquipmentInfo">
<part name="equipmentNumber" type="xsd:long"></part>
</message>
<message name="getEquipmentInfoResponse">
<part name="return" type="tns:equipmentInfo"></part>
</message>
<portType name="EquipmentWebService">
<operation name="getEquipmentInfo">
<input message="tns:getEquipmentInfo"></input>
<output message="tns:getEquipmentInfoResponse"></output>
</operation>
</portType>
<binding name="EquipmentWebServicePortBinding" type="tns:EquipmentWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"></soap:binding>
<operation name="getEquipmentInfo">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal" namespace="http://ws.krms.kone.com/"></soap:body>
</input>
<output>
<soap:body use="literal" namespace="http://ws.krms.kone.com/"></soap:body>
</output>
</operation>
</binding>
<service name="EquipmentWebServiceService">
<port name="EquipmentWebServicePort" binding="tns:EquipmentWebServicePortBinding">
<soap:address location="http://eudnt238:8083/ws/equipment-service"></soap:address>
</port>
</service>
</definitions>





AND equipment-service.xml ::


<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws.krms.kone.com/">

<xs:complexType name="equipmentInfo">
<xs:sequence>
<xs:element name="equipmentNumber" type="xs:long"></xs:element>
<xs:element name="errorMessage" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="language" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="sapEquipmentNumber" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="serialNumber" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Anonymous

Anonymous wrote:Thank's for your answer SamareshKowshik.
The java codes are the files in WEB-INF/src/connectivity.ws.operations.

It's seems that the java code in WEB-INF/src/connectivity.ws.operations associated to the wsop2 file is incomplete.

Here is the wsdl, with the xml file associated.




<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.krms.kone.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.krms.kone.com/" name="EquipmentWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.krms.kone.com/" schemaLocation="equipment-service.xml"></xsd:import>
</xsd:schema>
</types>
<message name="getEquipmentInfo">
<part name="equipmentNumber" type="xsd:long"></part>
</message>
<message name="getEquipmentInfoResponse">
<part name="return" type="tns:equipmentInfo"></part>
</message>
<portType name="EquipmentWebService">
<operation name="getEquipmentInfo">
<input message="tns:getEquipmentInfo"></input>
<output message="tns:getEquipmentInfoResponse"></output>
</operation>
</portType>
<binding name="EquipmentWebServicePortBinding" type="tns:EquipmentWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"></soap:binding>
<operation name="getEquipmentInfo">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal" namespace="http://ws.krms.kone.com/"></soap:body>
</input>
<output>
<soap:body use="literal" namespace="http://ws.krms.kone.com/"></soap:body>
</output>
</operation>
</binding>
<service name="EquipmentWebServiceService">
<port name="EquipmentWebServicePort" binding="tns:EquipmentWebServicePortBinding">
<soap:address location="http://URL/equipment-service"></soap:address>
</port>
</service>
</definitions>





AND equipment-service.xml ::


<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws.krms.kone.com/">

<xs:complexType name="equipmentInfo">
<xs:sequence>
<xs:element name="equipmentNumber" type="xs:long"></xs:element>
<xs:element name="errorMessage" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="language" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="sapEquipmentNumber" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="serialNumber" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Hmm, generally the Java files are just automatically created when the WSOP is, and there shouldn't be any errors. If something did happen to them, you could recreate the WSOP and see if that clears it up. Maybe copy/paste your Java file here and I can compare it to what I have (or use the Attachments feature in the new forum, if you can).

Also, there is a bit of unwrapping that needs to be done for the response, so maybe try unchecking "Unwrap Output Parameters" when creating the WSOP, on the second page of the wizard. Then you can create some Java to get values out. OD is generally capable of unwrapping this level of tree structure in the response, but perhaps simplifying by taking that out will help.

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


GetEquipmentInfoResponse response = (GetEquipmentInfoResponse) mySession.getVariableField(IProjectVariables.RETURN_1).getObjectValue();
EquipmentInfo info = response.get_return();

long num = info.getEquipmentNumber();
String msg = info.getErrorMessage();
String language = info.getLanguage();
String sapNum = info.getSapEquipmentNumber();
String serial = info.getSerialNumber();

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);
}
desirekengfack
Joined: Nov 13, 2013
Messages: 10
Offline
hi,
finally we made the call to the webservice in a servlet.
But as you say, I still do not understand why the generated code does not work alone.
The wsop file was deleted and recreated, but we have the same error :!: .


here is the generated code :



package connectivity.ws.operations;

/**
* This class is generated automatically. Manual edits must be outside of the tagged
* areas (for example, "START:CLASS:..." and "END:CLASS:..."). Changes within the
* tag areas will be overwritten when the web service operation is regenerated.
* Last generated by Orchestration Designer at: 5 NOVEMBRE 2013 17:56:07 CET
*/
public class GetEquipmentInfo extends com.avaya.sce.runtime.connectivity.ws2.CallService {

//{{START:CLASS:FIELDS
//}}END:CLASS:FIELDS

/**
* Constructor for GetEquipmentInfo.
*/
public GetEquipmentInfo( com.avaya.sce.runtimecommon.IRuntimeSession mySession ) {
//{{START:CLASS:CONSTRUCTOR
super(mySession);

//Web Service
setServiceName("EquipmentWebServiceService");
setSOAPAction("http://ws.krms.kone.com/EquipmentWebService/getEquipmentInfoRequest");
setTimeoutSecondsFromParameter("EquipmentWebServiceService_1383670567018TimeoutSeconds");
setEndpointFromParameter("EquipmentWebServiceService_1383670567018EndpointUrl");
setAuthenticationFromParameter("EquipmentWebServiceService_1383670567018Authentication");
setPasswordFromParameter("EquipmentWebServiceService_1383670567018Password");
setUsernameFromParameter("EquipmentWebServiceService_1383670567018Username");
setUsernameTokenTimeoutFromParameter("EquipmentWebServiceService_1383670567018UserNameTokenTimeout");
setSendPasswordInClearFromParameter("EquipmentWebServiceService_1383670567018SendPasswordInClear");

//Operation
setOperation(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfo"));
setOperationNSPrefix("");
setWrappedStyle(true);

//Input parameters
{
com.avaya.sce.runtime.connectivity.ws2.WsParam param1 = new com.avaya.sce.runtime.connectivity.ws2.WsParam(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfo"), new javax.xml.namespace.QName("connectivity.ws.beans", "GetEquipmentInfo"));
param1.setWrapped(false);
param1.setArray(false);
param1.setUseJavaObject(false);
param1.setNsPrefix("ns1");

{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field2 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "equipmentNumber"), new javax.xml.namespace.QName("", "long"), param1);
field2.setNsPrefix("ns1");
field2.setDDVariableName("equipmentNumber");
field2.setUseJavaObject(false);
param1.addField(field2);
}
addInParameter(param1);
}

//Output parameters
{
com.avaya.sce.runtime.connectivity.ws2.WsParam param1 = new com.avaya.sce.runtime.connectivity.ws2.WsParam(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfoResponse"), new javax.xml.namespace.QName("connectivity.ws.beans", "GetEquipmentInfoResponse"));
param1.setWrapped(false);
param1.setArray(false);
param1.setUseJavaObject(false);
param1.setNsPrefix("ns1");

{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field2 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "return"), new javax.xml.namespace.QName("", "EquipmentInfo"), param1);
field2.setNsPrefix("ns1");
field2.setDDVariableName("return1");
field2.setUseJavaObject(false);
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "equipmentNumber"), new javax.xml.namespace.QName("", "long"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "sapEquipmentNumber"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "serialNumber"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
param1.addField(field2);
}
addOutParameter(param1);
}
//}}END:CLASS:CONSTRUCTOR


}
}


SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Interesting. The Java file I have is different than the one you have. I'm assuming that we are both using the same WSDL? Here is the sample response I get when I send a request to SoapUI. The mock webservice in SoapUI was created using the WSDL you sent.

<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.krms.kone.com/"><soapenv:Body>

<ws:getEquipmentInfoResponse>
<return>
<equipmentNumber>?</equipmentNumber>
<errorMessage>?</errorMessage>
<language>?</language>
<sapEquipmentNumber>?</sapEquipmentNumber>
<serialNumber>?</serialNumber>
</return>
</ws:getEquipmentInfoResponse>
</soapenv:Body></soapenv:Envelope>


I see fields for language and errorMessage as well. My only guess is that the web service is sending back a response that the client isn't expecting. Somehow they are out of sync. Usually, being out of sync gives you an exception, which is why this is weird. Below is my Java file:

package connectivity.ws.operations;


/**
* This class is generated automatically. Manual edits must be outside of the tagged
* areas (for example, "START:CLASS:..." and "END:CLASS:..."). Changes within the
* tag areas will be overwritten when the web service operation is regenerated.
* Last generated by Orchestration Designer at: 2013-NOV-11 12:13:19 PM
*/
public class untitled5 extends com.avaya.sce.runtime.connectivity.ws2.CallService {

//{{START:CLASS:FIELDS
//}}END:CLASS:FIELDS

/**
* Constructor for untitled5.
*/
public untitled5( com.avaya.sce.runtimecommon.IRuntimeSession mySession ) {
//{{START:CLASS:CONSTRUCTOR
super(mySession);

//Web Service
setServiceName("EquipmentWebServiceService");
setSOAPAction("http://ws.krms.kone.com/EquipmentWebService/getEquipmentInfoRequest");
setTimeoutSecondsFromParameter("EquipmentWebServiceService_1384200797611TimeoutSeconds");
setEndpointFromParameter("EquipmentWebServiceService_1384200797611EndpointUrl");
setAuthenticationFromParameter("EquipmentWebServiceService_1384200797612Authentication");
setPasswordFromParameter("EquipmentWebServiceService_1384200797612Password");
setUsernameFromParameter("EquipmentWebServiceService_1384200797612Username");
setUsernameTokenTimeoutFromParameter("EquipmentWebServiceService_1384200797612UserNameTokenTimeout");
setSendPasswordInClearFromParameter("EquipmentWebServiceService_1384200797613SendPasswordInClear");

//Operation
setOperation(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfo"));
setOperationNSPrefix("");
setWrappedStyle(true);

//Input parameters
{
com.avaya.sce.runtime.connectivity.ws2.WsParam param1 = new com.avaya.sce.runtime.connectivity.ws2.WsParam(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfo"), new javax.xml.namespace.QName("connectivity.ws.beans5", "GetEquipmentInfo"));
param1.setWrapped(false);
param1.setArray(false);
param1.setUseJavaObject(false);
param1.setNsPrefix("ns1");

{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field2 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "equipmentNumber"), new javax.xml.namespace.QName("", "long"), param1);
field2.setNsPrefix("ns1");
field2.setDDVariableName("equipmentNumber");
field2.setUseJavaObject(false);
param1.addField(field2);
}
addInParameter(param1);
}

//Output parameters
{
com.avaya.sce.runtime.connectivity.ws2.WsParam param1 = new com.avaya.sce.runtime.connectivity.ws2.WsParam(new javax.xml.namespace.QName("http://ws.krms.kone.com/", "getEquipmentInfoResponse"), new javax.xml.namespace.QName("connectivity.ws.beans5", "GetEquipmentInfoResponse"));
param1.setWrapped(false);
param1.setArray(false);
param1.setUseJavaObject(false);
param1.setNsPrefix("ns1");

{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field2 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "return"), new javax.xml.namespace.QName("", "EquipmentInfo"), param1);
field2.setNsPrefix("ns1");
field2.setDDVariableName("return1");
field2.setUseJavaObject(false);
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "equipmentNumber"), new javax.xml.namespace.QName("", "long"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "errorMessage"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "language"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "sapEquipmentNumber"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
{
com.avaya.sce.runtime.connectivity.ws2.WsParamField field3 = new com.avaya.sce.runtime.connectivity.ws2.WsParamField(new javax.xml.namespace.QName("", "serialNumber"), new javax.xml.namespace.QName("", "java.lang.String"), field2);
field3.setNsPrefix("ns1");
field3.setDDVariableName("");
field3.setUseJavaObject(false);
field2.addField(field3);
}
param1.addField(field2);
}
addOutParameter(param1);
}
//}}END:CLASS:CONSTRUCTOR

}

}


You'll notice there are the two extra parameters I mentioned above that it is expecting to receive back. That XML response you originally sent, is that taken straight from OD's log? Or is that just the ideal scenario? Also, when you used the servlet you mentioned in your latest post, did you uncheck the Unwrap Output Parameters option? I ask because if it's treating the response as an object, and the web service is out of sync, it wouldn't technically matter because you can get the three values you're interested in out of the object and ignore the others. Perhaps check to see if there are setter/getter methods for language and errorMessage.
Anonymous

I have deleted the wsop file and create another one.
Now, I get the same java code as yours.

But the error is still there.


That XML response you originally sent, is that taken straight from OD's log? Or is that just the ideal scenario?

==> The xml is from OD's log.

Also, when you used the servlet you mentioned in your latest post, did you uncheck the Unwrap Output Parameters option?
I have deleted the wsop file, and make a call to the webservice directy in a servlet, by writting a java code for that.
Go to:   
Mobile view