From: Martin K. <mar...@fe...> - 2008-08-19 19:15:09
|
Hi, does someone know why this call fails? Unfortunately, I'm not a MIME expert. Martin -------- Weitergeleitete Nachricht -------- > Von: Bob Dole <bob...@ya...> > Antwort an: bob...@ya... > An: kut...@us... > Betreff: SOAP with Attachments not supported? > Datum: Mon, 18 Aug 2008 12:50:07 -0700 (PDT) > > Quick prefix which could make it so that you don't have to answer the > long question: does "Supports single/multipart MIME attachment > (parsing side only)." mean that a SOAP::Lite client can't send SwA? > > The longer question is why the following doesn't work. I have a > SOAP::Lite client and a gSOAP server. I want to send a MIME file from > one to the other. > > Here's the message I sent to the gSOAP list: > ------------------------------------------------------ > > I am trying to send a MIME encoded file from a SOAP::Lite client to a > gSOAP server, but the server is giving me the following error which I > don't understand, since I'm not that experienced with SOAP: > Error 6 fault: SOAP-ENV:Client [no subcode] > "No XML element tag" > Detail: [no detail] > The following is the command I run (I include the source at the end > incase the raw messages don't show an obvious error) > $ ./MIMEsend.pl soapcpp2.exe > Calling client setup > SOAP::Transport::new: () > SOAP::Serializer::new: () > SOAP::Deserializer::new: () > SOAP::Parser::new: () > SOAP::Lite::new: () > SOAP::Transport::HTTP::Client::new: () > Calling sendMIME > SOAP::Data::new: () > SOAP::Lite::call: () > SOAP::Serializer::envelope: () > SOAP::Serializer::envelope: sendMIME SOAP::Data=HASH(0x1075d488) > SOAP::Data::new: () > SOAP::Data::new: () > SOAP::Data::new: () > SOAP::Data::new: () > SOAP::Data::new: () > SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH > (0x1060ece8) > SOAP::Transport::HTTP::Client::send_receive: POST > http://192.168.0.131:1234/ HTTP/1.1 > Accept: text/xml > Accept: multipart/* > Accept: application/soap > Content-Length: 600620 > Content-Type: Multipart/Related; type="text/xml"; > start="<main_envelope>"; boundary="----------=_1219045514-2988-0"; cha > rset=utf-8 > SOAPAction: "capture#sendMIME" > This is a multi-part message in MIME format... > ------------=_1219045514-2988-0 > Content-Type: text/xml > Content-Disposition: inline > Content-Location: /main_envelope > Content-ID: <main_envelope> > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope > xmlns:namesp1="capture" xmlns:SOAP-ENV="http://schemas.xmlsoap. > org/soap/envelope/" > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsi="http://www.w3.org/2001/XMLSchem > a-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP- > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encodin > g/"><SOAP-ENV:Body><namesp1:sendMIME><magicNumber > xsi:type="xsd:int">123</magicNumber></namesp1:sendMIME></SOAP-ENV:Body > ></SOAP-ENV:Envelope> > ------------=_1219045514-2988-0 > Content-Type: application/exe; name="soapcpp2.exe" > Content-Disposition: attachment; filename="soapcpp2.exe" > Content-Transfer-Encoding: base64 > MIME-Version: 1.0 > X-Mailer: MIME-tools 5.427 (Entity 5.427) > TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAA > ...MIME FILE... > TkdQQURESU5HWFhQQURESU5H > ------------=_1219045514-2988-0-- > SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH > (0x1076f8c8) > SOAP::Transport::HTTP::Client::send_receive: 500 read failed: > Connection reset by peer > Content-Type: text/plain > Client-Date: Mon, 18 Aug 2008 07:45:28 GMT > Client-Warning: Internal response > 500 read failed: Connection reset by peer > SOAP::Deserializer::deserialize: () > SOAP::Parser::decode: () > 500 read failed: Connection reset by peer at ./MIMEsend.pl line 23 > SOAP::Transport::HTTP::Client::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Parser::DESTROY: () > SOAP::Transport::DESTROY: () > SOAP::Serializer::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Deserializer::DESTROY: () > SOAP::Data::DESTROY: () > SOAP::Lite::DESTROY: () > > > So my first question would be, is it because of the "This is a multi- > part message in MIME format..."? Is that the thing missing the XML > element it's talking about? Because that's the only thing I can see > that seems to differ from the SwA spec. > > So for the record, my gSOAP code looks like this (basically just the > example code from the documentation): > > int ns__sendMIME(struct soap *soap, int magicNumber, int &result){ > struct soap_multipart * attachment; > for(attachment = soap->mime.list; attachment; attachment = > attachment->next){ > printf("MIME attachment:\n"); > printf("Memory=%p\n", (*attachment).ptr); > printf("Size=%ul\n", (*attachment).size); > printf("Encoding=%d\n", (int)(*attachment).encoding); > printf("Type=%s\n", (*attachment).type? > (*attachment).type:"null"); > printf("ID=%s\n", (*attachment).id? > (*attachment).id:"null"); > printf("Location=%s\n", (*attachment).location? > (*attachment).location:"null"); > printf("Description=%s\n", (*attachment).description? > (*attachment).description:"null"); > } > printf("magicNumber = %#x\n", magicNumber); > if(magicNumber == 123){ > result = 42; > } > else{ > result = 0; > } > return SOAP_OK; > } > > My SOAP::Lite code looks like this: > > #!perl > use SOAP::Lite +trace => 'all'; > #use SOAP::Lite; > use SOAP::Lite::Packager; > use MIME::Entity; > my $ent = build MIME::Entity > Type => "application/exe", > Path => $ARGV[0], > Filename => $ARGV[0], > Disposition => "attachment"; > print "\nCalling client setup\n\n"; > $client = SOAP::Lite > -> packager(SOAP::Lite::Packager::MIME->new) > -> parts([$ent]) > -> proxy('http://192.168.0.131:1234/') > -> ns('capture'); > print "\nCalling sendMIME\n\n"; > $data = SOAP::Data->name(magicNumber => "123"); > $result = $client->sendMIME($data); > #print "result = $result\n"; > > Thanks for any help you can give! > > Bob > |