Error message "unexpected element name" encountered when trying to consume an external web service

sliderzen

Member
Error message \"unexpected element name\" encountered when trying to consume an external web service

Hi people,

I'm trying to consume an external web service and encountered the following error when trying to run the service in JDeveloper. I'm new to both java and WSDL. Please lend a helping hand. Thanks for your help in advance.

Error:

C:\JDeveloper\jdk\bin\javaw.exe -client -classpath C:\E900\DEMO\Java\classes;C:\JDeveloper\webservices\lib\jaxrpc-api.jar;C:\JDeveloper\webservices\lib\wsclient.jar;C:\JDeveloper\webservices\lib\wsserver.jar;C:\JDeveloper\webservices\lib\wssecurity.jar;C:\JDeveloper\webservices\lib\wsdl.jar;C:\JDeveloper\webservices\lib\orasaaj.jar;C:\JDeveloper\webservices\lib\saaj-api.jar;C:\JDeveloper\webservices\lib\orawsdl.jar;C:\JDeveloper\webservices\lib\orawsrm.jar;C:\JDeveloper\webservices\lib\jaxr_api.jar;C:\JDeveloper\webservices\lib\orajaxr.jar;C:\JDeveloper\webservices\lib\relaxngDatatype.jar;C:\JDeveloper\webservices\lib\jaxb-impl.jar;C:\JDeveloper\webservices\lib\jaxb-libs.jar;C:\JDeveloper\webservices\lib\xsdlib.jar;C:\JDeveloper\webservices\lib\mdds.jar;C:\JDeveloper\jlib\jaxen.jar;C:\JDeveloper\jlib\oraclepki.jar;C:\JDeveloper\jlib\ojpse.jar;C:\JDeveloper\jlib\osdt_core.jar;C:\JDeveloper\jlib\osdt_cert.jar;C:\JDeveloper\jlib\osdt_xmlsec.jar;C:\JDeveloper\jlib\osdt_wss.jar;C:\JDeveloper\jlib\osdt_saml.jar;C:\JDeveloper\jlib\repository.jar;C:\JDeveloper\jlib\ojmisc.jar;C:\JDeveloper\j2ee\home\lib\http_client.jar;C:\JDeveloper\j2ee\home\jazncore.jar;C:\JDeveloper\j2ee\home\oc4jclient.jar;C:\JDeveloper\rdbms\jlib\xdb.jar;C:\JDeveloper\diagnostics\lib\ojdl2.jar;C:\E900\DEMO\ini\sbf;C:\E900\System\Classes\Base_JAR.jar;C:\E900\System\Classes\BizLogicContainer_JAR.jar;C:\E900\System\Classes\BusinessLogicServices_JAR.jar;C:\E900\System\Classes\Connector.jar;C:\E900\System\Classes\EventProcessor_JAR.jar;C:\E900\System\Classes\Generator_JAR.jar;C:\E900\System\Classes\JdbjBase_JAR.jar;C:\E900\System\Classes\JdbjInterfaces_JAR.jar;C:\E900\System\Classes\JdeNet_JAR.jar;C:\E900\System\Classes\Maf2Base_JAR.jar;C:\E900\System\Classes\mafsecurity.jar;C:\E900\System\Classes\Metadata.jar;C:\E900\System\Classes\MetadataInterface.jar;C:\E900\System\Classes\PMApi_JAR.jar;C:\E900\System\Classes\SBFFoundation_JAR.jar;C:\E900\System\Classes\Spec_JAR.jar;C:\E900\System\Classes\System_JAR.jar;C:\E900\System\Classes\SystemInterfaces_JAR.jar;C:\E900\System\Classes\castor.jar;C:\E900\System\Classes\log4j.jar;C:\E900\System\Classes\xerces.jar;C:\E900\System\Classes\xml-apis.jar;C:\E900\System\Classes\Rijndael.jar;C:\E900\System\Classes\ManagementAgent_JAR.jar;C:\E900\System\Classes\commons-logging.jar;C:\E900\System\Classes\commons-codec-1.3.jar;C:\E900\System\Classes\commons-httpclient-3.0.jar;C:\E900\System\Classes\jmxremote.jar;C:\E900\System\Classes\jmxremote_optional.jar;C:\E900\System\Classes\jmxri.jar;C:\E900\System\Classes\rmissl.jar;C:\E900\misc\classes12.jar;C:\E900\misc\mssqlserver.jar;C:\E900\misc\msutil.jar;C:\E900\misc\msbase.jar;C:\E900\misc\db2java.zip;C:\E900\misc\jt400.jar;C:\E900\misc\sqljdbc.jar;C:\E900\misc\ojdbc5.jar;C:\JDeveloper\lib\xmlparserv2.jar;C:\JDeveloper\lib\xml.jar oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceClient
calling http://XXX.XX.XXX.XX:8080/PSIGW/HttpListeningConnector
unexpected element name: expected={http://xxxx.xxxx.com}EnquiryByLegacyIdResponse, actual=EnquiryByLegacyIdResponse
at oracle.j2ee.ws.common.encoding.literal.LiteralObjectSerializerBase.internalDeserialize(LiteralObjectSerializerBase.java:231)
at oracle.j2ee.ws.common.encoding.literal.LiteralObjectSerializerBase.deserialize(LiteralObjectSerializerBase.java:159)
at oracle.e1.bssv.J5500002.proxy.runtime.CrmCustomerServiceSoapBinding_Stub._deserialize_EnquiryByLegacyId(CrmCustomerServiceSoapBinding_Stub.java:348)
at oracle.e1.bssv.J5500002.proxy.runtime.CrmCustomerServiceSoapBinding_Stub._readFirstBodyElement(CrmCustomerServiceSoapBinding_Stub.java:283)
at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:335)
at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:114)
at oracle.e1.bssv.J5500002.proxy.runtime.CrmCustomerServiceSoapBinding_Stub.enquiryByLegacyId(CrmCustomerServiceSoapBinding_Stub.java:238)
at oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceClient.enquiryByLegacyId(CrmCustomerServiceClient.java:55)
at oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceClient.main(CrmCustomerServiceClient.java:41)
Process exited with exit code 0.

--- the definition for java class "CrmCustomerServiceClient.java" ---

package oracle.e1.bssv.J5500002.proxy;

import oracle.webservices.transport.ClientTransport;
import oracle.webservices.OracleStub;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Stub;

public class CrmCustomerServiceClient {
private oracle.e1.bssv.J5500002.proxy.CrmCustomerService _port;

public CrmCustomerServiceClient() throws Exception {
ServiceFactory factory = ServiceFactory.newInstance();
_port = ((oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceService)factory.loadService(oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceService.class)).getCrmCustomerService();
}


/**
* @param args
*/
public static void main(String[] args) {
try {
oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceClient myPort = new oracle.e1.bssv.J5500002.proxy.CrmCustomerServiceClient();
System.out.println("calling " + myPort.getEndpoint());


// Add your own code here
EnquiryByLegacyId test = new EnquiryByLegacyId ();
test.setSETID("CTN");
test.setCPL_LEGACY_ID("03-135452");


//EnquiryByLegacyIdResponse response = new EnquiryByLegacyIdResponse();
//response = myPort.enquiryByLegacyId(test);
//EnquiryByLegacyIdResponse response = myPort.enquiryByLegacyId(test);


CrmCustomerId cus = new CrmCustomerId();


//cus = response.getEnquiryByLegacyIdReturn();
cus = (myPort.enquiryByLegacyId(test)).getEnquiryByLegacyIdReturn();


System.out.println("Your username is " + cus.getCUST_ID()+cus.getRESPOND_MSG());


} catch (Exception ex) {
ex.printStackTrace();
}
}


/**
* delegate all operations to the underlying implementation class.
*/


public EnquiryByLegacyIdResponse enquiryByLegacyId(EnquiryByLegacyId parameters) throws java.rmi.RemoteException {
return _port.enquiryByLegacyId(parameters);
}


public EnquiryByNationalIdResponse enquiryByNationalId(EnquiryByNationalId parameters) throws java.rmi.RemoteException {
return _port.enquiryByNationalId(parameters);
}


public EnquiryByNameResponse enquiryByName(EnquiryByName parameters) throws java.rmi.RemoteException {
return _port.enquiryByName(parameters);
}


public EnquiryByPhoneCellResponse enquiryByPhoneCell(EnquiryByPhoneCell parameters) throws java.rmi.RemoteException {
return _port.enquiryByPhoneCell(parameters);
}



/**
* used to access the JAX-RPC level APIs
* returns the interface of the port instance
*/
public oracle.e1.bssv.J5500002.proxy.CrmCustomerService getPort() {
return _port;
}


public String getEndpoint() {
return (String) ((Stub) _port)._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
}


public void setEndpoint(String endpoint) {
((Stub) _port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpoint);
}


public String getPassword() {
return (String) ((Stub) _port)._getProperty(Stub.PASSWORD_PROPERTY);
}


public void setPassword(String password) {
((Stub) _port)._setProperty(Stub.PASSWORD_PROPERTY, password);
}


public String getUsername() {
return (String) ((Stub) _port)._getProperty(Stub.USERNAME_PROPERTY);
}


public void setUsername(String username) {
((Stub) _port)._setProperty(Stub.USERNAME_PROPERTY, username);
}


public void setMaintainSession(boolean maintainSession) {
((Stub) _port)._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, Boolean.valueOf(maintainSession));
}


public boolean getMaintainSession() {
return ((Boolean) ((Stub) _port)._getProperty(Stub.SESSION_MAINTAIN_PROPERTY)).booleanValue();
}


/**
* returns the transport context
*/
public ClientTransport getClientTransport() {
return ((OracleStub) _port).getClientTransport();
}


}


--- the definition for java class "EnquiryByLegacyIdResponse.java" ---

package oracle.e1.bssv.J5500002.proxy;

public class EnquiryByLegacyIdResponse implements java.io.Serializable {
protected oracle.e1.bssv.J5500002.proxy.CrmCustomerId enquiryByLegacyIdReturn;


public EnquiryByLegacyIdResponse() {
}


public oracle.e1.bssv.J5500002.proxy.CrmCustomerId getEnquiryByLegacyIdReturn() {
return enquiryByLegacyIdReturn;
}


public void setEnquiryByLegacyIdReturn(oracle.e1.bssv.J5500002.proxy.CrmCustomerId enquiryByLegacyIdReturn) {
this.enquiryByLegacyIdReturn = enquiryByLegacyIdReturn;
}
}


__--- the definition for the WSDL" ---__

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://xxxx.xxxx.com" xmlns:intf="http://xxxx.xxxx.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xxxx.xxxx.com">
<!--WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xxxx.xxxx.com">


<element name="EnquiryByLegacyId">
<complexType>
<sequence>
<element name="SETID" type="xsd:string" />
<element name="CPL_LEGACY_ID" type="xsd:string"/>
</sequence>
</complexType>
</element>


<element name="EnquiryByLegacyIdResponse">
<complexType>
<sequence>
<element name="EnquiryByLegacyIdReturn" type="impl:CrmCustomerId"/>
</sequence>
</complexType>
</element>


<complexType name="CrmCustomerId">
<sequence>
<element name="SETID" nillable="false" type="xsd:string"/>
<element name="CPL_LEGACY_ID" nillable="true" type="xsd:string"/>
<element name="CUST_ID" nillable="true" type="xsd:string"/>
<element name="RESPOND_MSG" nillable="false" type="xsd:integer"/>
</sequence>
</complexType>



<element name="EnquiryByNationalId">
<complexType>
<sequence>
<element name="SETID" type="xsd:string"/>
<element name="NATIONAL_ID" type="xsd:string"/>
</sequence>
</complexType>
</element>


<element name="EnquiryByNationalIdResponse">
<complexType>
<sequence>
<element name="EnquiryByNationalIdReturn" type="impl:CrmCustomerId"/>
</sequence>
</complexType>
</element>


<complexType name="CrmCustomerId">
<sequence>
<element name="SETID" nillable="false" type="xsd:string"/>
<element name="CPL_LEGACY_ID" nillable="true" type="xsd:string"/>
<element name="CUST_ID" nillable="true" type="xsd:string"/>
<element name="RESPOND_MSG" nillable="false" type="xsd:integer"/>
</sequence>
</complexType>


<element name="EnquiryByName">
<complexType>
<sequence>
<element name="SETID" type="xsd:string"/>
<element name="LAST_NAME" type="xsd:string"/>
<element name="FIRST_NAME" type="xsd:string"/>
<element name="ADDRESS1" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="EnquiryByNameResponse">
<complexType>
<sequence>
<element name="EnquiryByNameReturn" type="impl:CrmCustomerId"/>
</sequence>
</complexType>
</element>


<complexType name="CrmCustomerId">
<sequence>
<element name="SETID" nillable="false" type="xsd:string"/>
<element name="CPL_LEGACY_ID" nillable="true" type="xsd:string"/>
<element name="CUST_ID" nillable="true" type="xsd:string"/>
<element name="RESPOND_MSG" nillable="false" type="xsd:integer"/>
</sequence>
</complexType>



<element name="EnquiryByPhoneCell">
<complexType>
<sequence>
<element name="SETID" type="xsd:string" />
<element name="PHONE_CELL" type="xsd:string"/>
</sequence>
</complexType>
</element>


<element name="EnquiryByPhoneCellResponse">
<complexType>
<sequence>
<element name="EnquiryByPhoneCellReturn" type="impl:CrmCustomerId"/>
</sequence>
</complexType>
</element>


<complexType name="CrmCustomerId">
<sequence>
<element name="SETID" nillable="false" type="xsd:string"/>
<element name="CPL_LEGACY_ID" nillable="true" type="xsd:string"/>
<element name="CUST_ID" nillable="true" type="xsd:string"/>
<element name="RESPOND_MSG" nillable="false" type="xsd:integer"/>
</sequence>
</complexType>



</schema>
</wsdl:types>


<wsdl:message name="EnquiryByLegacyIdRequest">

<wsdl:part element="intf:EnquiryByLegacyId" name="parameters"/>

</wsdl:message>

<wsdl:message name="EnquiryByLegacyIdResponse">

<wsdl:part element="intf:EnquiryByLegacyIdResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="EnquiryByNationalIdRequest">

<wsdl:part element="intf:EnquiryByNationalId" name="parameters"/>

</wsdl:message>

<wsdl:message name="EnquiryByNationalIdResponse">

<wsdl:part element="intf:EnquiryByNationalIdResponse" name="parameters"/>

</wsdl:message>


<wsdl:message name="EnquiryByNameRequest">

<wsdl:part element="intf:EnquiryByName" name="parameters"/>

</wsdl:message>


<wsdl:message name="EnquiryByNameResponse">

<wsdl:part element="intf:EnquiryByNameResponse" name="parameters"/>

</wsdl:message>


<wsdl:message name="EnquiryByPhoneCellRequest">

<wsdl:part element="intf:EnquiryByPhoneCell" name="parameters"/>

</wsdl:message>


<wsdl:message name="EnquiryByPhoneCellResponse">

<wsdl:part element="intf:EnquiryByPhoneCellResponse" name="parameters"/>

</wsdl:message>


<wsdl:portType name="CrmCustomerService">

<wsdl:eek:peration name="EnquiryByLegacyId">

<wsdl:input message="intf:EnquiryByLegacyIdRequest" name="EnquiryByLegacyIdRequest"/>

<wsdl:eek:utput message="intf:EnquiryByLegacyIdResponse" name="EnquiryByLegacyIdResponse"/>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByNationalId">

<wsdl:input message="intf:EnquiryByNationalIdRequest" name="EnquiryByNationalIdRequest"/>

<wsdl:eek:utput message="intf:EnquiryByNationalIdResponse" name="EnquiryByNationalIdResponse"/>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByName">

<wsdl:input message="intf:EnquiryByNameRequest" name="EnquiryByNameRequest"/>

<wsdl:eek:utput message="intf:EnquiryByNameResponse" name="EnquiryByNameResponse"/>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByPhoneCell">

<wsdl:input message="intf:EnquiryByPhoneCellRequest" name="EnquiryByPhoneCellRequest"/>

<wsdl:eek:utput message="intf:EnquiryByPhoneCellResponse" name="EnquiryByPhoneCellResponse"/>

</wsdl:eek:peration>


</wsdl:portType>

<wsdl:binding name="CrmCustomerServiceSoapBinding" type="intf:CrmCustomerService">

<wsdlsoap:binding style=""/>

<wsdl:eek:peration name="EnquiryByLegacyId">

<wsdlsoap:eek:peration soapAction="#CPL_LEGACY_ID_ENQ#CCH_TEST"/>

<wsdl:input name="EnquiryByLegacyIdRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:eek:utput name="EnquiryByLegacyIdResponse">

<wsdlsoap:body use="literal"/>

</wsdl:eek:utput>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByNationalId">

<wsdlsoap:eek:peration soapAction="#CPL_NATIONAL_ID_ENQ#CCH_TEST"/>

<wsdl:input name="EnquiryByNationalIdRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:eek:utput name="EnquiryByNationalIdResponse">

<wsdlsoap:body use="literal"/>

</wsdl:eek:utput>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByName">

<wsdlsoap:eek:peration soapAction="#CPL_NAME_ENQ#CCH_TEST"/>

<wsdl:input name="EnquiryByNameRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:eek:utput name="EnquiryByNameResponse">

<wsdlsoap:body use="literal"/>

</wsdl:eek:utput>

</wsdl:eek:peration>

<wsdl:eek:peration name="EnquiryByPhoneCell">

<wsdlsoap:eek:peration soapAction="#CPL_PHONE_CELL_ENQ#CCH_TEST"/>

<wsdl:input name="EnquiryByPhoneCellRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:eek:utput name="EnquiryByPhoneCellResponse">

<wsdlsoap:body use="literal"/>

</wsdl:eek:utput>

</wsdl:eek:peration>


</wsdl:binding>

<wsdl:service name="CrmCustomerServiceService">

<wsdl:port binding="intf:CrmCustomerServiceSoapBinding" name="CrmCustomerService">

<wsdlsoap:address location="http://XXX.XX.XXX.XX:8080/PSIGW/HttpListeningConnector"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>
 
Re: Error message \"unexpected element name\" encountered when trying to consume an external web service

Hi sliderzen,

Not help, just advices:

Do not include your large log into the post - add it as an attachment to your post and refer it in your post.

Always add your release, SP/TS level, platform, etc. information to your post.

Regards,

Zoltán
 
Re: Error message \"unexpected element name\" encountered when trying to consume an external web service

Hi

Have you tested the external web service with SoapUI? What response did you get? Did it include the Target namespace in the message, something like:

<SOAP-ENV:Body>
<EnquiryByLegacyIdResponse xmlns="http://xxxx.xxxx.com">
<EnquiryByLegacyIdReturn>

It may be a problem at the other end, not returning the message correctly according to the WSDL.

Dave
 
Back
Top