Skip to Content
avatar image
Former Member

Array in WebService - Deserialization Error

Hello,

we are facing a problem consuming a WebService provided by the Netweaver AppServer. The method was implemented using three parameters. Two integer and one Array of a structured Java type (DTO).

The problem is that our Delphi Client who gets the WSDL file from the server seems to be sending a request (which looks to be valid) but the Webservices causes a SOAP:Fault with a deserialization error.

Heres the Request:

<?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="urn:com.hbas.frame.dto.wrapper" xmlns:NS3="urn:com.hbas.frame.dto">
    <NS1:saveRepair xmlns:NS1="urn:Std_MES_InterfaceVi">
      <iLoc xsi:type="xsd:int">0</iLoc>
      <iDB xsi:type="xsd:int">0</iDB>
      <repWrap href="#1"/>
    </NS1:saveRepair>
    <NS2:RepWrapperDTO id="1" xsi:type="NS2:RepWrapperDTO">
      <arRep xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="NS3:RepDTO[2]">
        <item href="#2"/>
        <item href="#4"/>
      </arRep>
      <iTypeOfRepair xsi:type="xsd:int">3</iTypeOfRepair>
    </NS2:RepWrapperDTO>
    <NS3:RepDTO id="2" xsi:type="NS3:RepDTO">
      <dClientDate xsi:type="xsd:dateTime">2008-08-25T10:48:26.251+02:00</dClientDate>
      <iAdapterID xsi:type="xsd:int">1</iAdapterID>
      <iCreateMode xsi:type="xsd:int">0</iCreateMode>
      <iErrorReference xsi:type="xsd:int">3146</iErrorReference>
      <iMessageState xsi:type="xsd:int">3</iMessageState>
      <iPinNumber xsi:type="xsd:int">1</iPinNumber>
      <iPkForRep xsi:type="xsd:int">0</iPkForRep>
      <iPlace xsi:type="xsd:int">30001</iPlace>
      <iProzessID xsi:type="xsd:int">20</iProzessID>
      <iReponseProzess xsi:type="xsd:int">0</iReponseProzess>
      <iResponsible1 xsi:type="xsd:int">-2147482006</iResponsible1>
      <iResponsible2 xsi:type="xsd:int">0</iResponsible2>
      <iReworkReference xsi:type="xsd:int">0</iReworkReference>
      <iTestMode xsi:type="xsd:int">0</iTestMode>
      <iTestState xsi:type="xsd:int">0</iTestState>
      <iTestStep xsi:type="xsd:int">0</iTestStep>
      <sBCBoard xsi:type="xsd:string">100000000951</sBCBoard>
      <sBauteilMatNr xsi:type="xsd:string">00001337483</sBauteilMatNr>
      <sFertigEC xsi:type="xsd:string">020</sFertigEC>
      <sLine xsi:type="xsd:string">0</sLine>
      <sNumberPos xsi:type="xsd:string">0000605</sNumberPos>
      <sPartCode xsi:type="xsd:string">0828</sPartCode>
      <sPersonalID xsi:type="xsd:string">0</sPersonalID>
      <sProdID xsi:type="xsd:string">100000000951</sProdID>
      <sRepairDescr xsi:type="xsd:string">lten</sRepairDescr>
      <sResponseCode xsi:type="xsd:string">1250</sResponseCode>
      <sSNR xsi:type="xsd:string">1512188</sSNR>
    </NS3:RepDTO>
    <NS3:RepDTO id="4" xsi:type="NS3:RepDTO">
      <dClientDate xsi:type="xsd:dateTime">2008-08-25T10:48:26.251+02:00</dClientDate>
      <iAdapterID xsi:type="xsd:int">1</iAdapterID>
      <iCreateMode xsi:type="xsd:int">0</iCreateMode>
      <iErrorReference xsi:type="xsd:int">0</iErrorReference>
      <iMessageState xsi:type="xsd:int">0</iMessageState>
      <iPinNumber xsi:type="xsd:int">0</iPinNumber>
      <iPkForRep xsi:type="xsd:int">0</iPkForRep>
      <iPlace xsi:type="xsd:int">30004</iPlace>
      <iProzessID xsi:type="xsd:int">32</iProzessID>
      <iReponseProzess xsi:type="xsd:int">0</iReponseProzess>
      <iResponsible1 xsi:type="xsd:int">0</iResponsible1>
      <iResponsible2 xsi:type="xsd:int">0</iResponsible2>
      <iReworkReference xsi:type="xsd:int">0</iReworkReference>
      <iTestMode xsi:type="xsd:int">0</iTestMode>
      <iTestState xsi:type="xsd:int">0</iTestState>
      <iTestStep xsi:type="xsd:int">0</iTestStep>
      <sLine xsi:type="xsd:string">0</sLine>
      <sPersonalID xsi:type="xsd:string">0</sPersonalID>
      <sProdID xsi:type="xsd:string">100000000951</sProdID>
      <sRepairDescr xsi:type="xsd:string">lten</sRepairDescr>
    </NS3:RepDTO>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response by the server:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Client</faultcode>
      <faultstring>Deserializing reference elements fails. Nested message: XML Deserialization Error. Can not create instance of class [NULL] when deserializing XML type [http://schemas.xmlsoap.org/soap/encoding/][Array]..</faultstring>
      <detail>
        <ns1:com.sap.engine.services.webservices.additions.soaphttp.exceptions.ProcessException xmlns:ns1='http://sap-j2ee-engine/error'>Deserializing reference elements fails. Nested message: XML Deserialization Error. Can not create instance of class [NULL] when deserializing XML type [http://schemas.xmlsoap.org/soap/encoding/][Array]..</ns1:com.sap.engine.services.webservices.additions.soaphttp.exceptions.ProcessException>
      </detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

If I change the type definition to "ArrayOfRepDTO" which is described in the WSDL file and do not use the <item..> references by copying the whole DTO content to the tag it works in HTTP but not in the Delphi Client.

E.g.:

<?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="urn:com.hbas.frame.dto.wrapper" xmlns:NS3="urn:com.hbas.frame.dto">
    <NS1:saveRepair xmlns:NS1="urn:Std_MES_InterfaceVi">
      <iLoc xsi:type="xsd:int">0</iLoc>
      <iDB xsi:type="xsd:int">0</iDB>
      <repWrap href="#1"/>
    </NS1:saveRepair>
    <NS2:RepWrapperDTO id="1" xsi:type="NS2:RepWrapperDTO">
      <arRep xsi:type="NS3:ArrayOfRepDTO">
        <NS3:RepDTO id="2" xsi:type="NS3:RepDTO">
          <dClientDate xsi:type="xsd:dateTime">2008-08-25T10:48:26.251+02:00</dClientDate>
          <iAdapterID xsi:type="xsd:int">1</iAdapterID>
          <iCreateMode xsi:type="xsd:int">0</iCreateMode>
          <iErrorReference xsi:type="xsd:int">3146</iErrorReference>
          <iMessageState xsi:type="xsd:int">3</iMessageState>
          <iPinNumber xsi:type="xsd:int">1</iPinNumber>
          <iPkForRep xsi:type="xsd:int">0</iPkForRep>
          <iPlace xsi:type="xsd:int">30001</iPlace>
          <iProzessID xsi:type="xsd:int">20</iProzessID>
          <iReponseProzess xsi:type="xsd:int">0</iReponseProzess>
          <iResponsible1 xsi:type="xsd:int">-2147482006</iResponsible1>
          <iResponsible2 xsi:type="xsd:int">0</iResponsible2>
          <iReworkReference xsi:type="xsd:int">0</iReworkReference>
          <iTestMode xsi:type="xsd:int">0</iTestMode>
          <iTestState xsi:type="xsd:int">0</iTestState>
          <iTestStep xsi:type="xsd:int">0</iTestStep>
          <sBCBoard xsi:type="xsd:string">100000000951</sBCBoard>
          <sBauteilMatNr xsi:type="xsd:string">00001337483</sBauteilMatNr>
          <sFertigEC xsi:type="xsd:string">020</sFertigEC>
          <sLine xsi:type="xsd:string">0</sLine>
          <sNumberPos xsi:type="xsd:string">0000605</sNumberPos>
          <sPartCode xsi:type="xsd:string">0828</sPartCode>
          <sPersonalID xsi:type="xsd:string">0</sPersonalID>
          <sProdID xsi:type="xsd:string">100000000951</sProdID>
          <sRepairDescr xsi:type="xsd:string">lten</sRepairDescr>
          <sResponseCode xsi:type="xsd:string">1250</sResponseCode>
          <sSNR xsi:type="xsd:string">1512188</sSNR>
        </NS3:RepDTO>
        <NS3:RepDTO id="4" xsi:type="NS3:RepDTO">
          <dClientDate xsi:type="xsd:dateTime">2008-08-25T10:48:26.251+02:00</dClientDate>
          <iAdapterID xsi:type="xsd:int">1</iAdapterID>
          <iCreateMode xsi:type="xsd:int">0</iCreateMode>
          <iErrorReference xsi:type="xsd:int">0</iErrorReference>
          <iMessageState xsi:type="xsd:int">0</iMessageState>
          <iPinNumber xsi:type="xsd:int">0</iPinNumber>
          <iPkForRep xsi:type="xsd:int">0</iPkForRep>
          <iPlace xsi:type="xsd:int">30004</iPlace>
          <iProzessID xsi:type="xsd:int">32</iProzessID>
          <iReponseProzess xsi:type="xsd:int">0</iReponseProzess>
          <iResponsible1 xsi:type="xsd:int">0</iResponsible1>
          <iResponsible2 xsi:type="xsd:int">0</iResponsible2>
          <iReworkReference xsi:type="xsd:int">0</iReworkReference>
          <iTestMode xsi:type="xsd:int">0</iTestMode>
          <iTestState xsi:type="xsd:int">0</iTestState>
          <iTestStep xsi:type="xsd:int">0</iTestStep>
          <sLine xsi:type="xsd:string">0</sLine>
          <sPersonalID xsi:type="xsd:string">0</sPersonalID>
          <sProdID xsi:type="xsd:string">100000000951</sProdID>
          <sRepairDescr xsi:type="xsd:string">lten</sRepairDescr>
        </NS3:RepDTO>
      </arRep>
      <iTypeOfRepair xsi:type="xsd:int">3</iTypeOfRepair>
    </NS2:RepWrapperDTO>

  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This is working the manual way. But I cannot specify this to the Delphi Client. Can I make the deserializer understand this type of SOAP? Or did anyone else encounter this problem? The other way, if I have an array as response the Delphi Client understands the structure in the SOAP. What can I do?

Regards,

Kai

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 14, 2008 at 04:47 PM

    Hi Kai,

    Considering the problem you are describing above, the exception is related to some point in your Delphi code where we probably we could find some NullPointerException as well as Java Exceptions.

    Such as you have said, I intend that a good way out is try to test your WebService deployed at Netweaver side using web service navigator to investigate the return of web service execution, probably there are more than one null fields.

    Add comment
    10|10000 characters needed characters exceeded