locked
Web Service, Two Xml Request Difference ( How to remove xsi:type="xsd:string" )

    Question

  • Hi everyone ;
    I'm really noob about theese topics but  I have to solve this problem.

    I have a web service on a remote machine works perfectly with many clients I tested.

    But the company who will use my web service has developed the same web service of mine coz we're trying to sycn. data in both servers.

    2 sides have both clients and services.  Their client is generated from their wsdl document ( I don't know why they do this) and as I understand they developed their client with java.

    So that my web service have to be inherited from their web services' wsdl file in order to talk their clients.

    There was a problem when I push the data to web service , all parameters are lost at the runtime.
    But  I listened the network traffic :

    My Client which is generated from my web service by Visual C# express 2008;
    Sends a request like this and works perfectly
     <?xml version="1.0" encoding="utf-8" ?> 
     <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     <soap:Body> 
     <subscription xmlns="http://ws.chatapat.com/"
      <user>username</user> 
      <pwd>password</pwd> 
      <serviceId>Service Id</serviceId> 
      <msisdn>Ms Isdn</msisdn> 
      <status>Status</status> 
      <extra>Some extra string</extra> 
      </subscription> 
      </soap:Body> 
      </soap:Envelope> 
     



    The client I created from their wsdl , sends a data like this
     
     <?xml version="1.0" encoding="utf-8" ?> 
     <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://ws.chatapat.com" xmlns:types="http://ws.chatapat.com/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     <tns:subscription> 
      <user xsi:type="xsd:string">username</user> 
      <pwd xsi:type="xsd:string">password</pwd> 
      <serviceId xsi:type="xsd:string">Service Id</serviceId> 
      <msisdn xsi:type="xsd:string">Ms Isdn</msisdn> 
      <status xsi:type="xsd:string">Status</status> 
      <extra xsi:type="xsd:string">Some extra string</extra> 
      </tns:subscription> 
      </soap:Body> 
      </soap:Envelope> 



    This second request can not be read by my web service. The only difference is 
    "xsi:type" attributes and "tns" attribute before subscription tag.

    Now I'm asking ,
    How can I remove "xsi:type" and "tns" or how can  I make my web service to understand this type of xml formatting ?

    Thank you.

    Monday, October 27, 2008 9:54 PM

Answers

  • Hello again ;
    I solved the problems .

    First problem  was about SOAPAction header was a "MUST" , I needed it to be accepted as an empty string , coz my client was sending SOAPAction = "" .

    [SoapRpcService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

    This attribute changed routing style SOAPAction to RequestElement , and empty SOAPAction headers are welcome from now on.


    And the second problem , about xml formatting. xsi:type and tns thing.

    When you create a web service in VS 2008 , 

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    is set defult.

    I changed this attribute to

    [WebServiceBinding(ConformsTo = WsiProfiles.None)]

    And everything works like a charm now. .NET web service , Java client speaks very well.

    http://msdn.microsoft.com/en-us/library/ms152180.aspx
    http://msdn.microsoft.com/en-us/library/system.web.services.webservicebindingattribute.aspx

    • Marked as answer by edhickey Tuesday, November 04, 2008 4:00 PM
    Thursday, October 30, 2008 9:55 PM

All replies

  • What is the exact problem you are having? Saying "it cannot be read" really tells us nothing.

    Also, you may be mistaken about the cause of the problem.
    John Saunders | Use File->New Project to create Web Service Projects
    Thursday, October 30, 2008 11:48 AM
    Moderator
  • The problem is that your second clients sends soap in an "rpc/encoded" format instead of "document/literal".
    The main reason for this is probably that the wsdl requires to use this format. However in this case the client should have worked.
    My Guess is that their Java service is in "rpc/encoded" - in contrast to your service - and your second client fails due to another interoperability issue. You need to get s SOAP sample of their Java client and compare it to yours. After this you need to decide if you or them will change the service to the agreed format.


    Please publish here the WSDL if you want us to understand what format it is. Also try to publish the sample soap that their client creates. In addition let us know if you use "add service reference" or "Add web reference".


    http://webservices20.blogspot.com/
    WCF Performance, Interoperability And Testing Blog
    Thursday, October 30, 2008 1:13 PM
  • Hello again ;
    I solved the problems .

    First problem  was about SOAPAction header was a "MUST" , I needed it to be accepted as an empty string , coz my client was sending SOAPAction = "" .

    [SoapRpcService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

    This attribute changed routing style SOAPAction to RequestElement , and empty SOAPAction headers are welcome from now on.


    And the second problem , about xml formatting. xsi:type and tns thing.

    When you create a web service in VS 2008 , 

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    is set defult.

    I changed this attribute to

    [WebServiceBinding(ConformsTo = WsiProfiles.None)]

    And everything works like a charm now. .NET web service , Java client speaks very well.

    http://msdn.microsoft.com/en-us/library/ms152180.aspx
    http://msdn.microsoft.com/en-us/library/system.web.services.webservicebindingattribute.aspx

    • Marked as answer by edhickey Tuesday, November 04, 2008 4:00 PM
    Thursday, October 30, 2008 9:55 PM