cancel
Showing results for 
Search instead for 
Did you mean: 

XML Serialization Error- While testing BAPI turned Web service

Former Member
0 Kudos

I have a requirement to create sales order in SAP R/3 from an e-commerce site. I went through many forums suggesting "exposing FMs into Web Service". I wrapped BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_TRANSACTION_COMMIT into one FM and exposed as Web Service. I did a successful test-sequence.

When I tested the web service without giving values I got a response asking for "Sold-to Party or Ship-To Party". While testing the Web service with some values, I got the below error -

XML Serialization Error. Object content does not correspond to Schema restrictions of type [urn:sap-com:document:sap:rfc:functions][numeric4].

The e-commerce team tried to hit the Web service and got the below error-

IWAB0383E Error validating parameters

Note: Our servers does not have any ENHPacks. Only ECC 6.0.

Please suggest what might have gone wrong and how to resolve this.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please check WSDL of webservice for correct format of data type (XSD data type is not similar to ABAP data type), you can see the hint: numeric4.

Search wsdl for numeric4 datatype (usually you will find it in the beginning of WSDL)


- <xsd:simpleType name="numeric4">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="4" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>

and make sure your input value is comply with restriction of datatype.

Regards,

Gourav

Former Member
0 Kudos

Hi Gourav Khare,

I have created WSDL file through function module in SAP-ECC 5.0v.

I have followed below steps:

Crated FM (SE37)

Crated Web-service (SE37)

Generated WSDL file using (WSADMIN)

And consumed WSDF file in SOAP UI (SOAP UI 4.5.2 Trailer version)

Problem is: while consuming WSDL file in  SOAP UI I getting  ‘Serialisation failed’

For your reference I have furnished xml string below.

SOAP UI Input:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">

<soapenv:Header/>

<soapenv:Body>

<urn:YSDF_INV_PRINT_FINAL_RFC_WS_N>

<!--Optional:-->

<PWR_INVOICE>

<INVOICE_SHIPPED_LINE>

<!--Zero or more repetitions:-->

<item>

<POSITION1></POSITION1>

<SALES_PART></SALES_PART>

                  <PART_DESC></PART_DESC>

<PRICE></PRICE>

<QUANTITY></QUANTITY>

<CUSTOMER_TAX_NO></CUSTOMER_TAX_NO>

<PROD_NONINVENTORY></PROD_NONINVENTORY>

<PROD_TAXABLE></PROD_TAXABLE>

<TAX_LEVEL></TAX_LEVEL>

</item>

</INVOICE_SHIPPED_LINE>

<INVOICE_NO></INVOICE_NO>

<ORDER_NO></ORDER_NO>

<DATE_PRINTED></DATE_PRINTED>

<DIV_CD></DIV_CD>

            <LAST_COST_INVOICE></LAST_COST_INVOICE>

<DELETE_ZERO_COST></DELETE_ZERO_COST>

<DELETE_NON_SHIPPED></DELETE_NON_SHIPPED>

<GLOBALREF></GLOBALREF>

<ORIGIN></ORIGIN>

<ORIGINID></ORIGINID>

</PWR_INVOICE>

</urn:YSDF_INV_PRINT_FINAL_RFC_WS_N>

</soapenv:Body>

</soapenv:Envelope>

SOAP UI Output:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

<soap-env:Body>

<soap-env:Fault>

<faultcode>soap-env:Client</faultcode>

<faultstring xml:lang="en">Serialisation failed</faultstring>

<detail>

<n0:SimpleTransformationFault xmlns:n0="http://www.sap.com/transformation-templates">

<MainName>/1BCDWB/WSS0130716111624448000</MainName>

<ProgName>/1BCDWB/WSS0130716111624448000</ProgName>

<Line>8</Line>

<Valid>X</Valid>

<ReferenceFault>

<DescriptionText>Error accessing the ref. node 'INVOICE_ID'</DescriptionText>

<RefName>INVOICE_ID</RefName>

</ReferenceFault>

<Caller>

                  <Class>CL_SRG_RFC_PROXY_CONTEXT</Class>

<Method>IF_SXML_PART~DECODE</Method>

<Positions>1</Positions>

</Caller>

</n0:SimpleTransformationFault>

</detail>

</soap-env:Fault>

</soap-env:Body>

</soap-env:Envelope>

And one more things are

I don't know the exact reason, but now the WSDL is working fine. No Idea, will it be consistent.

No changes in import and export parameters of RFC and no change in code, even if the logic is changed it should not affect the output on SOAP UI but in my case it does.

Wonder why all this happens, I cannot explain the exact reason technically because my RFC works fine every time, only issue is with SOAP UI.

From SAP point of view FM is working fine, and input parameter of FM is optional, validations are done by the programming logic and it will capture the message and its details with respect to input data.

I am not sure SOAP will work consistently and we are using ECC 5.0 most of the t-code not there like "SOAMANAGER" and all.  

Kindly help me on this

Thanks & Regards,

   Akshath.L.T

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Gaurav!

XML serialization error is resolved.

I'll raise another thread for the Eclipse Validation Error.

Former Member
0 Kudos

Thanks Khare!

I was able to fix the XML serialization error. Part of my question is resolved. The other part being consuming web service from Eclipse.

The Eclipse team is still hitting the same "validation error".

Q. What could be the possible reason behind hitting the "Validation error"?

Q. Where can I see the XSD for WSDL? [SAP WS was created in ECC 6.0.]

Q. If Creation of web service and consuming web services are in different LANs, what are the configuration required?

Regards-

Ajay

Former Member
0 Kudos

Hi,

Search your service in SOAMANAGER and then use binding WSDL from there.

No special configuration required If consumer and provider is on different LAN, only thing is required connectivity between those two LAN.

Regards,

Gourav