Loading ...
Sorry, an error occurred while loading the content.

perl client, java server, WSDL = deserialize error

Expand Messages
  • Konrad Kouowski
    Hello SOAP lovers, I m facing a problem of posting SOAP data to a server. I m getting Cannot deserialize element error. I was not able to import the types
    Message 1 of 1 , Nov 14, 2003
    • 0 Attachment
      Hello SOAP lovers,

      I'm facing a problem of posting SOAP data to a server. I'm getting
      "Cannot deserialize element" error.
      I was not able to import the types from WSDL file, so I'm doing it
      manually. I know about "maptype", and as I have read, this is something
      that is needed to have Perl - Java SOAP comunnication working, but I'm
      missing an example with WSDL file, where I can see:

      1) how to map type to an existing one in the WSDL description.
      2) how to make SOAP use namespaces from WSDL file ( I have edited
      $NS_SL_PERLTYPE in Lite.pm, using uri -> "http://myapp.somewhere.cz"
      did not help )


      As well I'm not sure whether I'm correctly handling <extension> tags in
      the WSDL descripton ( If this is the problem, why is my request failing
      on Sms element and not sooner on TextSms ? )


      Here are important part of my perl code, final XML request, response and
      WSDL description.

      Thanks everybody for any help.



      Perl code:

      my $soap = SOAP::Lite -> service('file:/opt/projects/myapp/service.wsdl');

      .
      .
      .

      $SOAP_Sms = SOAP::Data->type('TextSms')->name( textSms =>
      [

      $SOAP_Sms_base, # this object is created the same way as f.e.
      $SOAP_Sms ...

      SOAP::Data->type('boolean')->name( intruder => $intruder ),

      SOAP::Data->type('boolean')->name( multiPart => $multiPart ),

      SOAP::Data->type('string')->name( text => $text )
      ]);


      my $SOAP_messageContainer =
      SOAP::Data->type('MessageContainer')->name('MessageContainer_1'=>[
      $SOAP_selector, $SOAP_Sms ]);



      $soap->send($SOAP_messageContainer);

      **************************************************************************************************************



      SOAP request:


      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:namesp1="http://myapp.somewhere.cz"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
      <send xmlns="">
      <MessageContainer_1 xsi:type="namesp1:MessageContainer"
      SOAP-ENC:arrayType="xsd:ur-type[2]">
      <selector xsi:type="xsd:string">TextSms</selector>
      <textSms xsi:type="namesp1:TextSms"
      SOAP-ENC:arrayType="xsd:ur-type[4]">
      <Sms xsi:type="namesp1:Sms"
      SOAP-ENC:arrayType="xsd:ur-type[7]">
      <Request xsi:type="namesp1:Request"
      SOAP-ENC:arrayType="xsd:ur-type[2]">
      .
      .
      </Request>
      <fromNumber xsi:type="xsd:string">12345</fromNumber>
      <premiumInfo xsi:type="namesp1:premiumInfo"
      SOAP-ENC:arrayType="xsd:string[3]">
      .
      .
      </premiumInfo>
      <protocolIdentifier
      xsi:type="xsd:string">64</protocolIdentifier>
      <reportLevel xsi:type="xsd:string">all</reportLevel>
      <toNumber xsi:type="xsd:string">654321</toNumber>
      <validityPeriod
      xsi:type="xsd:string">3600</validityPeriod>
      </Sms>
      <intruder xsi:type="xsd:boolean">0</intruder>
      <multiPart xsi:type="xsd:boolean">0</multiPart>
      <text xsi:type="xsd:string">test message</text>
      </textSms>
      </MessageContainer_1>
      </send>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>





      ***************************************************************************************************************

      Response:

      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2 001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <soapenv:Fault>
      <faultcode
      xmlns:wasws="http://websphere.ibm.com/webservices/" xml
      ns="">wasws:Server.generalException</faultcode>
      <faultstring xmlns="">
      <![CDATA[org.xml.sax.SAXException: WSWS3047E: Error:
      Cannot deserialize element SMS of bean cz.somewhere.myapp.TextSms.]]>
      </faultstring>
      <detail xmlns="">
      <stackTrace xmlns="http://websphere.ibm.com/webservices/">
      <![CDATA[org.xml.sax.SAXException: WSWS3047E: Error:
      Cannot deserialize element SMS of bean cz.somewhere.myapp.TextSms.
      at
      com.ibm.ws.webservices.engine.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:285)
      at
      com.ibm.ws.webservices.engine.events.P2DConverter.startElement(P2DConverter.java:346)
      at
      com.ibm.ws.webservices.engine.events.P2DConverter.startElement(P2DConverter.java:287)
      at sax.SAX2DocumentEntityParserBase.startElement(Unknown Source)
      at
      sax.latin.LatinWFCSAX2DocumentEntityParser.startElement(Unknown Source)
      at sax.SAX2DocumentEntityParserBase.startElementAction(Unknown
      Source)
      at util.DocumentEntityParserBase.startElementEvent(Unknown Source)
      at
      com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanStartElement(Unknown
      Source)
      at
      com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanContent(Unknown
      Source)
      at
      com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanDocument(Unknown
      Source)
      at
      sax.latin.LatinWFCSAX2DocumentEntityParser.scanDocument(Unknown Source)
      at util.DocumentEntityParserBase.parse(Unknown Source)
      at sax.SAX2DocumentEntityParserBase.parseEntity(Unknown Source)
      at sax.SAX2DocumentEntityParserBase.parse(Unknown Source)
      at javax.xml.parsers.SAXParser.parse(Unknown Source)
      at
      com.ibm.ws.webservices.engine.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:256)
      at
      com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:698)
      at
      com.ibm.ws.webservices.engine.Message.getSOAPEnvelope(Message.java:440)
      at
      com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCSOAPHandler.checkSOAPSemantics(JAXRPCSOAPHandler.java:218)
      at
      com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCSOAPHandler.invokeServerRequestHandler(JAXRPCSOAPHandler.java:188)
      at
      com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler$1.invoke(JAXRPCHandler.java:232)
      at
      com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:203)
      at
      com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:61)
      at
      com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:217)
      at
      com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:217)
      at
      com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:258)
      at
      com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:835)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at
      com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at
      com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
      at
      com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
      at
      com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
      at
      com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
      at
      com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
      at
      com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
      at
      com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
      at
      com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
      at
      com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
      at
      com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
      at
      com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
      at
      com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
      at
      com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
      at
      com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
      at
      com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
      at
      com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at
      com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at
      com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
      ]]></stackTrace></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>


      ***************************************************************************************************************



      Here are important parts of the WSDL file:

      <?xml version="1.0" encoding="UTF-8"?>
      <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:tns="http://myapp.somewhere.cz"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      name="MessagingGateway" targetNamespace="http://myapp.somewhere.cz">
      <types>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      targetNamespace="http://myapp.somewhere.cz">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      .
      .
      <complexType name="Sms">
      <complexContent>
      <extension base="tns:Request">
      <sequence>
      <element name="fromNumber" type="string" nillable="true"/>
      <element name="premiumInfo" type="tns:PremiumInfo"
      nillable="true"/>
      <element name="protocolIdentifier" type="string"
      nillable="true"/>
      <element name="reportLevel" type="string" nillable="true"/>
      <element name="toNumber" type="string" nillable="true"/>
      <element name="validityPeriod" type="long"/>
      </sequence>
      </extension>
      </complexContent>
      </complexType>
      <complexType name="TextSms">
      <complexContent>
      <extension base="tns:Sms">
      <sequence>
      <element name="intruder" type="boolean"/>
      <element name="multiPart" type="boolean"/>
      <element name="text" type="string" nillable="true"/>
      </sequence>
      </extension>
      </complexContent>
      </complexType>
      <complexType name="MessageContainer">
      <sequence>
      <element name="binarySms" type="tns:BinarySms" nillable="true"/>
      <element name="mms" type="tns:Mms" nillable="true"/>
      <element name="response" type="tns:Response" nillable="true"/>
      <element name="selector" type="string" nillable="true"/>
      <element name="textSms" type="tns:TextSms" nillable="true"/>
      </sequence>
      </complexType>
      .
      .
      <complexType name="send">
      <sequence>
      <element name="MessageContainer_1" type="tns:MessageContainer"
      nillable="true"/>
      </sequence>
      </complexType>
    Your message has been successfully submitted and would be delivered to recipients shortly.