cancel
Showing results for 
Search instead for 
Did you mean: 

Missing Namespace with the SOAP msg sent by C#

Former Member
0 Kudos

Hi All,

The wsdl file is generated by SAP XI. I used the XMLSpy to test it and get successful response.

Then I used wsdl.exe of .net 2.0 sdk to generate the C# proxy class, and use csc.exe to compile it to a dll, and then refer it in the project. After sent the soap message by C#, the XI shows the message is wrong, then I compare this soap envelop body with the one I sent by the XMLSpy as follow:

C#:

<MT_PP_014_PrdOrderGoodsRcv xmlns="http://mycompany.com/xi/sap/system/pp">

<content>

</content>

</MT_PP_014_PrdOrderGoodsRcv>

XMLSPY:

<m:MT_PP_014_PrdOrderGoodsRcv xmlns:m="http://mycompany.com/xi/sap/system/pp">

<content>

</content>

</m:MT_PP_014_PrdOrderGoodsRcv>

so it is the namespace, according the xml generated by C#, the MT_PP_014_PrdOrderGoodsRcv element isn't inlucded in the namespace http://mycompany.com/xi/sap/system/pp, which cause the error.

Anyone know how to fix it?

Thanks and B'Rgds,

Accepted Solutions (1)

Accepted Solutions (1)

henrique_pinto
Active Contributor
0 Kudos

Hi YiNing,

the message created by C# is indeed wrong.

Check that in XMLSpy message, the default namespace is never set and that the message namespace is set to prefix "m" and that only the root tag is included in this namespace. All the other tags have no namespace (since they are not attached to any namespace prefix) or have the default namespace, which was not set.

On the other hand, in the C# message, the default namespace is set in the root tag. The root tag is related to the default namespace (it has no prefix) and hence it has the proper namespace. However, the other tags are also related to the default namespace (no namespace prefix) which was set. So these other tags are the erroneous ones.

Try to check that in your proxy, but it seems like a bug in the proxy generator application.

Just as a test, send the message from C# in a request from XMLSpy (replace the automatically generated message inside SOAP Body). The same error would be expected.

Also as a test, send this message in XMLSpy:

<MT_PP_014_PrdOrderGoodsRcv xmlns="http://mycompany.com/xi/sap/system/pp">
<content xmlns="">
</content>
</MT_PP_014_PrdOrderGoodsRcv>

Regards,

Henrique.

Former Member
0 Kudos

Althought I think the XML C# sent to XI is wrong as well, but later I found the XI can accept this kind of SOAP, the really problem happens in mapping procedure, certain nodes disappear in the SOAP C# sent.

Answers (1)

Answers (1)

VijayKonam
Active Contributor
0 Kudos

As long as the WSDL is same it should not alter the namespace. Check the WSDL by opening it in text pad and try to find out whats exactly mentioned in the WSDL. This should not happen depending on .NET or Java kind of applications.

VJ