simon.proctor has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to interface a Java based SOAP server with a SOAP::Lite client. The two can communicate but sadly there seems to be an XML processing problem at the Java end:

javax.xml.soap.SOAPException: Unable to create envelope from given sou +rce: Error on line 1 of document : Undeclared prefix: "SOAP-ENV:enco +dingStyle"
The server, in this case, simply returns a default response back to the Perl client which is being decoded properly so thats not a problem.

From what I can tell, the processor does not like all the namespaces (and such) that get added to the Envelope by the SOAP::Lite call. Though this is valid XML is there anyway I can either:
  1. remove these by hand before transmitting to the server
  2. dynamically build the envelope as a string (or something similar) and transmit that?
I've been scouring the groups I could find but haven't found anything that comes close to this problem.

Source code for the client follows (I call as perl soap.pl). Note that I am not using RPC at this time but just whacking a mini XML document into the Body of the message.

If I'm committing any other sins then please let me know as I've only been using SOAP::Lite for a very short time.

use SOAP::Lite; use Data::Dumper; use strict; use warnings; my $data = <<EOL; <ar> <site url="127.0.0.1" /> <request id="2" type="text" command="AdvertByID" /> </ar> EOL my $service = new SOAP::Lite uri => 'http://test/', proxy => 'http://simonp.intranet-dev:8080/servlet/middleware', soapversion => 1.2, xmlschema => '2001' ; my $fragment = SOAP::Data->type(xml => $data); my $serializer = $service->serializer(); my $env = $serializer->envelope(freeform => $fragment); my $response = $service->call($env); my $body = $response->dataof('//Body/ar/al/ai'); # should give acces +s to body my $attr = $body->attr(); print "Type: ", $attr->{'type'},"\n"; print "ID: ", $attr->{'id'},"\n"; my $summary = $response->dataof('//Body/ar/al/ai/summary'); $attr = $summary->attr(); print "Summary: ", $attr->{'data'},"\n"; my $title = $response->dataof('//Body/ar/al/ai/title'); $attr = $title->attr(); print "Title: ", $attr->{'data'},"\n"; my $anchor = $response->dataof('//Body/ar/al/ai/anchor'); $attr = $anchor->attr(); print "Link: ", $attr->{'data'},"\n";

Replies are listed 'Best First'.
Re: Interfacing SOAP::Lite with JAXM based SOAP Server - XML Error
by redsquirrel (Hermit) on Jun 25, 2002 at 13:48 UTC
      Yes, I was going to but I can't access the groups very easily during the day due to corporate restrictions. Plus I prefer to come to Perlmonks first (just my little quirk :P ).

      Thanks though.