Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Soap

Status
Not open for further replies.

GrahamBright

Programmer
Oct 31, 2003
65
AT
Hi all, I'm having problems with the syntax of Soap (Soap::Lite, Soap::MIME, MIME::Entity) for perl. I've written the following piece of code: -

#!/opt/perl5/bin/perl
use SOAP::Lite +trace;
use SOAP::MIME;
use MIME::Entity;

$SOAP::Constants::DO_NOT_USE_CHARSET = 1;

my $cid = "Test";

my $ent = MIME::Entity->build(Boundary => "soap-boarder", Type => "mul
+tipart/related", 'Content-Id' =>"<$cid>");


print SOAP::Lite
-> uri('+/schema/REL-5-MM7-1-2')
-> on_action(sub { return "\"\""; })
-> proxy(' -> parts($ent)
#-> SubmitReq(SOAP::Data->name("MM7Version" => '5.3.0'))
-> result;

results in

mkuetk@smswxp2:~/perlScripts > perl Soap01.pl
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: result
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x85a1
+a2c)
SOAP::Transport::HTTP::Client::send_receive: POST +10021/vas_soap HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 1035
Content-Type: Multipart/Related; type="text/xml"; start="<main_envelop
+e>"; boundary="----------=_1
091521171-25073-0"
SOAPAction: ""

This is a multi-part message in MIME format...

------------=_1091521171-25073-0
Content-Type: text/xml
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Content-Location: /main_envelope
Content-Id: <main_envelope>

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-EN
+C="g/soap/encoding/" SOAP-ENV:encodingStyle="+oap/encoding/" xmlns:SOAP-EN
V=" xmlns:xsi="+.org/1999/XMLSchema-instance
" xmlns:xsd="+:result xmlns:namesp1="http:
//+"/></SOAP-ENV:Body></SOAP-EN
V:Envelope>
------------=_1091521171-25073-0
Content-Type: multipart/related; boundary="soap-boarder"
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 6.110 (Entity 6.109 )
Content-Id: <Test>

This is a multi-part message in MIME format...

--soap-boarder--

------------=_1091521171-25073-0--

SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x869
+c7a4)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser
+ver Error
Connection: close
Date: Tue, 03 Aug 2004 08:24:45 GMT
Server: Apache/1.3.20 (Unix) mod_ssl/2.8.4 OpenSSL/0.9.6
Content-Type: text/html; charset=iso-8859-1
Client-Date: Tue, 03 Aug 2004 08:19:32 GMT
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Title: 500 Internal Server Error

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
Please contact the server administrator,
mmscadm@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<P>
More information about this error may be available
in the server error log.<P>
</BODY></HTML>

SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
500 Internal Server Error at /usr/local/lib/perl5/site_perl/5.6.1/SOAP
+/MIME.pm line 207
SOAP::Lite::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Parser::DESTROY: ()

but this is useless and I need
POST /vas_soap HTTP/1.0
Content-Type: multipart/related; boundary="soap-border"; type="text/xm
+l";
start="Test"
Content-Length: 2749
Authorization: Basic NDM2NjQxMjMxMjM0OjEyMzQ=
SOAPAction: ""

--soap-border
Content-Type: application/xml
Content-ID: Test

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="+elope/"
xmlns="+ma/REL-5-MM7-1-2">
<SOAP-ENV:Header>
<TransactionID SOAP-ENV:mustUnderstand="1">TransID</TransactionI
+D>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SubmitReq>
<MM7Version>4.3.0</MM7Version>
<SenderIdentification>
<VASPID>436641231234</VASPID>
<VASID>News</VASID>
<SenderAddress>
<Number>436641231234</Number>
</SenderAddress>
</SenderIdentification>
<Recipients>
<To>
<Number>436643316123</Number>
</To>
</Recipients>
<ServiceCode>gold-sp33-im42</ServiceCode>
<LinkedID>mms00016666</LinkedID>
<MessageClass>Personal</MessageClass>
<DeliveryReport>False</DeliveryReport>
<ReadReply>False</ReadReply>
<Priority>Normal</Priority>
<Subject>MMSC-ATP-036_2</Subject>
<Content href="cid:SaturnPics-01020930@news.tnn.com" allowAda
+ptations="True"/>
</SubmitReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--soap-border
Content-Type: multipart/mixed; boundary="boundary

Questions: 1. Why is This is a multi-part message in MIME format... written to output. My guess is there is something wrong with my MIME::Entity object.

2. How can I modify the SOAP Envelope to produce the desired output. A million thanks, Tj.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top