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

.net-friendly soap messages with Apache::SOAP server

Expand Messages
  • snoogen314
    Hi folks, Here s a question I also posted on perlmonks: I m writing a soap server using Apache::SOAP (part of SOAP::Lite). The SOAP server provides an
    Message 1 of 1 , Apr 8, 2005
    • 0 Attachment
      Hi folks,

      Here's a question I also posted on perlmonks:

      I'm writing a soap server using Apache::SOAP (part of SOAP::Lite).
      The SOAP server provides an interface to a method
      DomainCheck->Check($domain) which performs various checks on a domain
      name. Check() returns an anon hash: { error => $int, severity => $int,
      text => $string }

      It works great with a SOAP::Lite client but .Net clients are confused
      by the xml sent back by the server.

      Here's my Apache::SOAP config in httpd.conf:

      <Location /DomainCheck>
      SetHandler perl-script
      PerlHandler Apache::SOAP
      PerlSetVar dispatch_to "DomainCheck"
      </Location>

      A simple perl client:

      #!/usr/bin/perl
      use strict;
      use SOAP::Lite;

      my $proxy = "https://10.191.110.64:8443/DomainCheck";
      my $uri = "http://10.191.110.64/DomainCheck";

      my $soap = SOAP::Lite->uri($uri)->proxy($proxy);
      $soap->on_debug(sub{print@_});

      my $result = $soap->Check("perl.com");


      Here's the xml sent by the perl client:

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
      <namesp1:Check xmlns:namesp1="http://10.191.110.64/DomainCheck">
      <c-gensym3 xsi:type="xsd:string">perl.com</c-gensym3>
      </namesp1:Check>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>


      and the xml sent back by the server:

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
      <namesp7:CheckResponse
      xmlns:namesp7="http://10.191.110.64/DomainCheck">
      <s-gensym27>
      <text xsi:type="xsd:string">Valid Domain</text>
      <error xsi:type="xsd:int">0</error>
      <severity xsi:type="xsd:int">0</severity>
      </s-gensym27>
      </namesp7:CheckResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      What confuses the .net client is mainly the <s-gensym27> tag and the
      namesp7 namespace. I have no idea where these tags come from, and why
      the number after them seem random (they change after each call)

      Anyhow, here's what a .net client would expect:

      <?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>
      <CheckResponse xmlns="http://snoogen/DomainCheck">
      <severity>0</severity>
      <error>0</error>
      <text>ok</text>
      </CheckResponse>
      </soap:Body>
      </soap:Envelope>

      Is there a way to make Apache::SOAP generate .net-friendly SOAP messages?
    Your message has been successfully submitted and would be delivered to recipients shortly.