Assign namespace to method paremeter

Hi,

 We are implementing web services for SAP.  

This is the SAP SOAP request message for GetAttribute method.

-----------------------------------------------------------------------------------

 < xml version="1.0" encoding="UTF-8" >
    <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">
     <SOAP-ENV:Header>
        <pre:user xmlns:pre="urn:IciUserInterface" SOAP-  ENV:mustUnderstand="0"                xsi:type="xsd:string">SPAREKH</pre:user>
        <pre:language xmlns:pre="urn:IciUserInterface" SOAP-ENV:mustUnderstand="0" xsi:type="xsd:string">EN</pre:language>
     </SOAP-ENV:Header>
     <SOAP-ENV:Body>
         <ns0:getAttributes xmlns:ns0="urn:IciUserInterface">
                      <userId xmlns="urn:IciUserInterface">ABC</userId>
        </ns0:getAttributes>
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

----------------------------------------------------------------------------

We have written a webservice which implements getAttribute method.

But we are not able to map the namespace parameter for the argument(userId) of getAttribtue message.  The generated SOAP message from our webservice is

-------------------------------------------------------------------------

< xml version="1.0" encoding="utf-8" >
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <MyHeader xmlns="http://wicom.com/ws/OII/IciUser/literalTypes">
      <user xmlns="urn:IciUserInterface">string</user>
      <language xmlns="urn:IciUserInterface">string</language>
    </MyHeader>
  </soap:Header>
  <soap:Body>
    <getAttributes xmlns="urn:IciUserInterface">
      <userId xmlns="">string</userId>
    </getAttributes>
  </soap:Body>
</soap:Envelope>

--------------------------------------------

Method getAttribute is getting executed succesfully but due to namespace mismatch, value of the parameter that we are getting in the method is empty string.

The code for the webservice is:

----------------------------------------------------------

[System.Web.Services.Protocols.SoapHeaderAttribute("header")]

[System.Web.Services.WebMethodAttribute(EnableSession=true)]

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://inqmy .com/soapdispatcher/rpc/bcbici/IciUserBean",

RequestNamespace="urn:IciUserInterface",

ResponseNamespace="urn:IciUserInterface",

Use=System.Web.Services.Description.SoapBindingUse.Literal ,

ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)

]

[return: System.Xml.Serialization.XmlElementAttribute("response",

Namespace="urn:IciUserInterface", IsNullable=true)]

public iciUser

getAttributes([System.Xml.Serialization.XmlElementAttribute(Form=System.

Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string userId)

{

 

 

}

--------------------------------------------------------

What changes to the code should we make inroder to overcome the namespace mismatch.

 

 

 

 

 

 

 




Answer this question

Assign namespace to method paremeter

  • Assign namespace to method paremeter