Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Perl server -> .Net client. Can't parse response due to namespace?

Expand Messages
  • Robin Keech
    Thanks for your reply Brad, I have used the SOAP data object to override the prefix and now get a soap response of:
    Message 1 of 3 , Dec 21, 2005
    • 0 Attachment
      Thanks for your reply Brad,

      I have used the SOAP data object to override the prefix and now get a soap response of:


      <SOAP-ENV:Body>

      <namesp1:createSessionResponse xmlns:namesp1="http://dpg.dialogue.net/WAP_Soap">

      <createSessionResponse xmlns="http://dpg.dialogue.net/WAP_Soap">
          <status xsi:type="xsd:int">06</status>
          <sessionID xsi:null="1"/>
          <redirectURL xsi:null="1"/>
      </createSessionResponse>

      </namesp1:createSessionResponse>

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

      The code to do this is:

      	my $myRes = SOAP::Data->name("createSessionResponse" => \SOAP::Data->value(
      		              SOAP::Data->name("status" => $result_hash{'status'}), 
      		              SOAP::Data->name("sessionID" => $result_hash{'sessionID'}),
      		              SOAP::Data->name("redirectURL" => $result_hash{'redirectURL'})
      		              )
      		             )->attr({ xmlns => 'http://dpg.dialogue.net/WAP_Soap' });
      	$myRes->prefix('');    
      	return($myRes);
      

      Anyone got any ideas on how to get rid of the outer <namesp1:createSessionResponse> elements that are now being duplicated?

      Thanks,

      Robin


      On Wed, 2005-12-21 at 08:20 -0500, Brad Miele wrote:
      Robin,

      I believe that there is something in the SOAP::Lite man page to this effect, or at least for working with .Net in general. for my web service, which was written solely for working with .Net clients, i dicovered that .Net didn't like the prefix stuff tha SOAP::Lite includes, an example of one of my responses is:

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <LogoutResponse xmlns="http://blahblahblah/ClientLogin/">
      <LogoutResult>0</LogoutResult>
      <errorMessage>SUCCESS</errorMessage>
      </LogoutResponse>
      </soap:Body></soap:Envelope>

       I had to remove the gensym and namesp tags.

      There *should* be a way to do this when you initialize SOAP::Lite, but i could never get it quite right, so i always end up hacking the .pm to correct it, if someone can show me an example of setting up the prefixes for .Net without hacking the module, that would be cool.

      In any case robin, i hope this helps.

      On 12/21/05, robin_keech1 <robin@...> wrote:
      Hi all,

      I have written a SOAP server using SOAP::Lite. It has a wsdl file at http://dpg.dialogue.net/WAP_Soap.wsdl

      I have tested the service with both perl and php clients. We have a new customer that is coding in .Net and having trouble integrating the method calls. The server logs show a method request and a result being sent back, but the client can't seem to get at the results. Initially they only received a string with "status", so I changed the wsdl to include a complex type as the return parameter. The actual perl server code just returns a hash.

      The client has said that "the .Net framework cannot parse the XML being returned from the createSession SOAP call as one of the namespaces is declared within the node using the namespace.  .NET needs it to be declared before it is used or it throws an error."

      Firstly, is this conclusion correct? Has anyone experienced a problem like this with .Net? And if it is, can anyone help with suggestions on suppressing/removing the namespace part.

      So the SOAP body looks like:
       <SOAP-ENV:Body>
       <namesp35:createSessionResponse xmlns:namesp35=" http://dpg.dialogue.net/WAP_Soap">
             <s-gensym283 xsi:type="xsd:string">status</s-gensym283>
             <s-gensym285 xsi:type="xsd:int">00</s-gensym285>
             <s-gensym287 xsi:type="xsd:string">sessionID</s-gensym287>
             <s-gensym289 xsi:type="xsd:string">42053C6A714211DA909B8DCE9602641D</s-gensym289>
             <s-gensym291 xsi:type="xsd:string">redirectURL</s-gensym291>
             <s-gensym293 xsi:type="xsd:string">http://myurl.com?s=42053C6A714211DA909B8DCE9602641D</s-gensym293>
       </namesp35:createSessionResponse>
       </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>
       
      But this won't work unless the namesp35 namespace is declared before it is used.  Taking out the section in bold should work, according to the customer.

      The other thing I though it might be was not encoding the result hash as a correct SOAPata type object that matches the wsdl description. Or maybe I should be looking at overriding the serialiser.

      As you can probably tell, I have no idea what to do to get this working. I don't have access to any .Net technology to play with. Any suggestions would be greatly appreciated.

      Robin



      YAHOO! GROUPS LINKS






      --
      Brad Miele                                                                                                                        
      Technology Director                                                                                                                
      IPNStock                                                                                                                          
      (866) 476-7862 x902                                                                                                                
      bmiele@...
    • sudhakar sharma
      Hi , i m new to soap lite..i have to create perl client that consume .net web service... from wsdl file i succefully install soap lite..and its woking..but
      Message 2 of 3 , Dec 22, 2005
      • 0 Attachment
        Hi , i m new to soap lite..i have to create perl client that consume .net web service...  from wsdl file
        i succefully install soap lite..and its woking..but problem is occur when i use complex type....
          im sending you my perl script file..plz have a look..give me suggestion..this is right way.. i also use stubmaker.pl  for making .pm file,but doesmt work..
         
        here is code of mine...
         
        # perl client
        # GetName method is complex type
        # problem: when client request to serevr ,serevr cant get any value from client
        # In addTwo method its simply take two parameters and return addtion of them..but when on server site its show o,o as input
        # as well as in GetName method i pass city name as "jaipur " but on server its show null
         
        $NS = "http://tempuri.org";      #name space
        $HOST = "
        http://localhost/sample1.asmx";
         
        use SOAP::Lite +trace => 'debug';
        my $_debug_=1;;
         
        my $localservice = SOAP::Lite -> uri($NS)
                                  -> on_action( sub { join "/", @_ } )
                                  -> proxy($HOST);
        #$localservice->proxy->timeout(100);
        $localservice ->xmlschema('2001');
         

        my $method2 = SOAP::Data->name('addTwo') ->attr({xmlns=>$NS});
        my @params = (
                      SOAP::Data->name(a => 4),
                      SOAP::Data->name(b => 4));
         
        my $result = $localservice->call($method2 => @params)->result;
         
        print $result;
         
        my $method = SOAP::Data->name('GetName') -> attr({xmlns => $NS});
         
        my @params = (
                      SOAP::Data->name('oPerson'=> \SOAP::Data->value(SOAP::Data->name('add'=>
                      \SOAP::Data->value(SOAP::Data->name('City' =>"jaipur"))))));
                     
         
        my $result = $localservice->call($method => @params)->result;
        print $result;
         
        thanks
        regards
        Sudhakar Sharma







        Send instant messages to your online friends http://uk.messenger.yahoo.com

      Your message has been successfully submitted and would be delivered to recipients shortly.