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

2702Re: [soaplite] FW: At my wits end.

Expand Messages
  • Brian Gilman
    Jun 12 9:00 AM
    • 0 Attachment
      On 6/12/03 11:13 AM, "Byrne Reese" <breese@...> wrote:

      Hey Byrne,

      I've gotten a lot farther this morning! I read an article at:

      http://soapenv.org/article.pl?sid=02/02/11/1740229&mode=thread

      Which helped me understand how SOAP::Lite handles complex data
      structures. But, I've hit two more walls:

      1) SOAP::Lite encodes arrays using it's own arrayType
      apache axis barfs on this

      2) Attachments don't work! or at least apache Axis dies when I try to
      use them.

      As for your questions about DataHandler: It get's serialized into a SOAP
      attachment

      Does it matter what ParameterInfo looks like in Java? Here's the SOAP
      structure that I want to build with corresponding SOAP::Lite code:

      <SOAP-ENV:Body><namesp1:submitJob xmlns:namesp1="Analysis"><name
      xsi:type="xsd:int">0</name><parameters xsi:type="SOAP-ENC:Array"
      SOAP-ENC:arrayType="xsd:ur-type[2]"><item><description
      xsi:type="xsd:string">input1</description><inputFile
      xsi:type="xsd:boolean">true</inputFile><label xsi:type="xsd:string"/><name
      xsi:type="xsd:string">-f1</name><outputFile
      xsi:type="xsd:boolean">false</outputFile><value
      xsi:type="xsd:string">/Users/gilmanb/mysql.html</value></item><item><descrip
      tion xsi:type="xsd:string">input1</description><inputFile
      xsi:type="xsd:boolean">true</inputFile><label xsi:type="xsd:string"/><name
      xsi:type="xsd:string">-f2</name><outputFile
      xsi:type="xsd:boolean">false</outputFile><value
      xsi:type="xsd:string">/Users/gilmanb/sourceforge/omnigene2/build.xml</value>
      </item></parameters></namesp1:submitJob></SOAP-ENV:Body>

      Here's the SOAP::Lite code that generates this:

      my $soap = SOAP::Lite
      ->uri("Analysis")
      ->on_action(sub {return "Analysis"})
      ->proxy("http://localhost:9090/axis/servlet/AxisServlet")
      #->parts([$ent1, $ent2])
      ->submitJob(SOAP::Data->name("name" => 0)
      ->type("xsd:int"),
      SOAP::Data->name("parameters" =>[

      \SOAP::Data->value(SOAP::Data->name("description"
      => "input1"),
      SOAP::Data->name("inputFile" =>
      "true")->type("xsd:boolean"),
      SOAP::Data->name("label" => ""),
      SOAP::Data->name("name" => "-f1"),
      SOAP::Data->name("outputFile" =>
      "false")->type("xsd:boolean"),
      SOAP::Data->name("value" => $file1)),

      \SOAP::Data->value(SOAP::Data->name("description"
      => "input1"),
      SOAP::Data->name("inputFile" =>
      "true")->type("xsd:boolean"),
      SOAP::Data->name("label" => ""),
      SOAP::Data->name("name" => "-f2"),
      SOAP::Data->name("outputFile" =>
      "false")->type("xsd:boolean"),
      SOAP::Data->name("value" => $file2))
      ])


      );


      Now here's what Apache Axis generates:

      I've cut and pasted this so that the superfluous stuff has been left
      out.

      <arg1 xsi:type="soapenc:Array" soapenc:arrayType="ns1:ParmInfo[2]"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <item href="#id0"/>
      <item href="#id1"/>
      </arg1>
      <multiRef id="id0" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns2:ParmInfo"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns2="Analysis">
      <attributes href="#id3"/>
      <description xsi:type="xsd:string">input file 1</description>
      <inputFile xsi:type="xsd:boolean">true</inputFile>
      <label xsi:type="xsd:string"></label>
      <name xsi:type="xsd:string">-f1</name>
      <outputFile xsi:type="xsd:boolean">false</outputFile>
      <value xsi:type="xsd:string">test1.txt</value>
      </multiRef>
      <multiRef id="id2" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <item>
      <key xsi:type="xsd:string">test1.txt</key>
      <value href="cid:519D4713CAC92D0A55F7F849680F1D56"
      xmlns:ns4="Analysis"/>
      </item>
      <item>
      <key xsi:type="xsd:string">test2.txt</key>
      <value href="cid:4D580598F9E5C89FA1FD17407BADABF5"
      xmlns:ns5="Analysis"/>
      </item>
      </multiRef>
      <multiRef id="id1" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns6:ParmInfo" xmlns:ns6="Analysis"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <attributes href="#id4"/>
      <description xsi:type="xsd:string">input file 2</description>
      <inputFile xsi:type="xsd:boolean">true</inputFile>
      <label xsi:type="xsd:string"></label>
      <name xsi:type="xsd:string">-f2</name>
      <outputFile xsi:type="xsd:boolean">false</outputFile>
      <value xsi:type="xsd:string">test2.txt</value>
      </multiRef>
      <multiRef id="id3" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns7:Map" xmlns:ns7="http://xml.apache.org/xml-soap"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <item>
      <key xsi:type="xsd:string">MODE</key>
      <value xsi:type="xsd:string">IN</value>
      </item>
      <item>
      <key xsi:type="xsd:string">TYPE</key>
      <value xsi:type="xsd:string">FILE</value>
      </item>
      </multiRef>
      <multiRef id="id4" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns8:Map" xmlns:ns8="http://xml.apache.org/xml-soap"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <item>
      <key xsi:type="xsd:string">MODE</key>
      <value xsi:type="xsd:string">IN</value>
      </item>
      <item>
      <key xsi:type="xsd:string">TYPE</key>
      <value xsi:type="xsd:string">FILE</value>
      </item>
      </multiRef>



      Now the problem is that SOAP::Lite has decided to use the following
      arrayType attribute:

      SOAP-ENC:arrayType="xsd:ur-type[2]

      I need this:

      SOAP-ENC:arrayType"namesp1:ParmInfo[2]

      Apache seems to choke on the "xsd:ur-type[2]"

      I'm thinking that I need a custom serializer here but, I don't have a
      clue where to start!

      Also, do you know if SOAP::Lite supports DIME? Or if there's a DIME
      library I can use? If so, where can I find it?

      I've attached the ParameterInfo class per your request.

      Thanks for the help!!

      > The method signature you provide is helpful, but without knowing
      > anything about the underlying data structures it is difficult to tell
      > you what you need to do. A custom serializer will certainly make things
      > easier for you, but I am not sure if you want to go into that level of
      > detail in your book. But who knows, maybe you do. :)
      >
      > The SOAP::MIME stuff looks good...
      >
      > As for constructing the ARRAY of objects, one can easily do that using
      > SOAP::Data objects as you have already indicated, but again, what does
      > the ParameterInfo and DataHandler objects "look like?"
      >
      > On Wed, 2003-06-11 at 20:31, Brian Gilman wrote:
      >> Hello,
      >>
      >> My name is Brian Gilman. I am currently writing a book on XML and
      >> BioInformatics for O'Reilly that includes a section on SOAP::Lite and
      >> Apache
      >> Axis toolkits.
      >>
      >> I am also the Inventor of a BioInformatics Toolkit called
      >> OmniGene. This
      >> is a toolkit that exposes Bioinformatics services as web services. I
      >> am
      >> trying to write a simple Client for our analysis engine. The method
      >> signature in java is:
      >>
      >> public JobInfo submitJob(int taskID, ParameterInfo[] parameters,
      >> DataHandler[] files);
      >>
      >> This is serialized into the SOAP messages: request and response
      >> attached
      >> and shown below.
      >>
      >> I have read through the perdoc/your book/ and a few hundred other
      >> resources and do not quite know how to write the code to talk to this
      >> service. I would like to put this into the book but cannot due to this
      >> roadblock.
      >>
      >> Here is what I understand so far:
      >>
      >> In order to do attachments I use SOAP::MIME. I wrote the following
      >> code
      >> to handle this (please forgive the really bad Perl coding as this is
      >> not my
      >> native tongue):
      >>
      >> if(@Files){
      >> foreach my $file (@Files){
      >> my $fileCounter++;
      >>
      >> my $ent = build MIME::Entity
      >> Type => "text/plain",
      >> Encoding => "binary",
      >> Path => $file,
      >> 'Content-Id' =>'<File' . $fileCounter . '>',
      >> Disposition => "attachment";
      >>
      >> push(@fileHolder, $ent);
      >> }
      >> }
      >>
      >> I pass this to a SOAP::Lite object using the ->parts(@fileHolder)
      >> method.
      >>
      >> Now here's where I get lost:
      >>
      >> I need to construct an array of objects called ParameterInfo and
      >> pass
      >> them to my service. How do I do this in SOAP::Lite? I've looked into
      >> SOAP::Data objects and they look promising but, I'm not sure how to
      >> get the
      >> SOAP::Lite toolkit to encode these as a Java Map (well in this case
      >> Axis
      >> serialized Map?). Do I need to make my own serializer here?
      >>
      >> I would really appreciate your help!
      >>
      >> Best,
      >>
      >> Brian Gilman
      >>
      >>
      >>
      >>
      >> ==============
      >> Listen Port: 9090
      >> Target Host: localhost
      >> Target Port: 8080
      >> ==== Request ====
      >> POST /axis/servlet/AxisServlet HTTP/1.0
      >>
      >> Content-Type: multipart/related; type="text/xml";
      >> start="<97C2115D38FF77499E2CA04BB838E901>";
      >> boundary="----=_Part_0_7089827.1055376896680"
      >>
      >> Accept: application/soap+xml, application/dime, multipart/related,
      >> text/*
      >>
      >> User-Agent: Axis/1.1RC2
      >>
      >> Host: localhost
      >>
      >> Cache-Control: no-cache
      >>
      >> Pragma: no-cache
      >>
      >> SOAPAction: ""
      >>
      >> Content-Length: 3796
      >>
      >>
      >>
      >>
      >>
      >> ------=_Part_0_7089827.1055376896680
      >>
      >> Content-Type: text/xml; charset=UTF-8
      >>
      >> Content-Transfer-Encoding: binary
      >>
      >> Content-Id: <97C2115D38FF77499E2CA04BB838E901>
      >>
      >>
      >>
      >> <?xml version="1.0" encoding="UTF-8"?>
      >> <soapenv:Envelope
      >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      >> <soapenv:Body>
      >> <ns1:submitJob
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xmlns:ns1="Analysis">
      >> <arg0 xsi:type="xsd:int">0</arg0>
      >> <arg1 xsi:type="soapenc:Array" soapenc:arrayType="ns1:ParmInfo[2]"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <item href="#id0"/>
      >> <item href="#id1"/>
      >> </arg1>
      >> <arg2 href="#id2"/>
      >> </ns1:submitJob>
      >> <multiRef id="id0" soapenc:root="0"
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xsi:type="ns2:ParmInfo"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      >> xmlns:ns2="Analysis">
      >> <attributes href="#id3"/>
      >> <description xsi:type="xsd:string">input file 1</description>
      >> <inputFile xsi:type="xsd:boolean">true</inputFile>
      >> <label xsi:type="xsd:string"></label>
      >> <name xsi:type="xsd:string">-f1</name>
      >> <outputFile xsi:type="xsd:boolean">false</outputFile>
      >> <value xsi:type="xsd:string">test1.txt</value>
      >> </multiRef>
      >> <multiRef id="id2" soapenc:root="0"
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <item>
      >> <key xsi:type="xsd:string">test1.txt</key>
      >> <value href="cid:519D4713CAC92D0A55F7F849680F1D56"
      >> xmlns:ns4="Analysis"/>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">test2.txt</key>
      >> <value href="cid:4D580598F9E5C89FA1FD17407BADABF5"
      >> xmlns:ns5="Analysis"/>
      >> </item>
      >> </multiRef>
      >> <multiRef id="id1" soapenc:root="0"
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xsi:type="ns6:ParmInfo" xmlns:ns6="Analysis"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <attributes href="#id4"/>
      >> <description xsi:type="xsd:string">input file 2</description>
      >> <inputFile xsi:type="xsd:boolean">true</inputFile>
      >> <label xsi:type="xsd:string"></label>
      >> <name xsi:type="xsd:string">-f2</name>
      >> <outputFile xsi:type="xsd:boolean">false</outputFile>
      >> <value xsi:type="xsd:string">test2.txt</value>
      >> </multiRef>
      >> <multiRef id="id3" soapenc:root="0"
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xsi:type="ns7:Map" xmlns:ns7="http://xml.apache.org/xml-soap"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <item>
      >> <key xsi:type="xsd:string">MODE</key>
      >> <value xsi:type="xsd:string">IN</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">TYPE</key>
      >> <value xsi:type="xsd:string">FILE</value>
      >> </item>
      >> </multiRef>
      >> <multiRef id="id4" soapenc:root="0"
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xsi:type="ns8:Map" xmlns:ns8="http://xml.apache.org/xml-soap"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <item>
      >> <key xsi:type="xsd:string">MODE</key>
      >> <value xsi:type="xsd:string">IN</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">TYPE</key>
      >> <value xsi:type="xsd:string">FILE</value>
      >> </item>
      >> </multiRef>
      >> </soapenv:Body>
      >> </soapenv:Envelope>
      >>
      >> ------=_Part_0_7089827.1055376896680
      >>
      >> Content-Type: text/plain
      >>
      >> Content-Transfer-Encoding: binary
      >>
      >> Content-Id: <519D4713CAC92D0A55F7F849680F1D56>
      >>
      >>
      >>
      >>> Test1
      >> aaaaaaaaggggggtttttttttccccccc
      >>
      >>
      >> ------=_Part_0_7089827.1055376896680
      >>
      >> Content-Type: text/plain
      >>
      >> Content-Transfer-Encoding: binary
      >>
      >> Content-Id: <4D580598F9E5C89FA1FD17407BADABF5>
      >>
      >>
      >>
      >>> Test2
      >> aaaaaaaatttttttggggggggggggggggccccccccccc
      >>
      >>
      >> ------=_Part_0_7089827.1055376896680--
      >>
      >> ==== Response ====
      >> HTTP/1.1 200 OK
      >>
      >> Set-Cookie: JSESSIONID=DAA82FFC4487D346BC5FFF90B8278066; Path=/axis
      >>
      >> Content-Type: text/xml; charset=utf-8
      >>
      >> Date: Thu, 12 Jun 2003 00:14:58 GMT
      >>
      >> Server: Apache Coyote/1.0
      >>
      >> Connection: close
      >>
      >>
      >>
      >> <?xml version="1.0" encoding="UTF-8"?>
      >> <soapenv:Envelope
      >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      >> <soapenv:Body>
      >> <ns1:submitJobResponse
      >> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xmlns:ns1="Analysis">
      >> <submitJobReturn xsi:type="ns1:JobInfo">
      >> <dateCompleted xsi:type="xsd:dateTime" xsi:nil="true"/>
      >> <dateSubmitted
      >> xsi:type="xsd:dateTime">2003-06-12T00:14:57.876Z</dateSubmitted>
      >> <inputFileName xsi:type="xsd:string"></inputFileName>
      >> <jobNumber xsi:type="xsd:int">0</jobNumber>
      >> <parameterInfo xsi:type="xsd:string"><?xml
      >> version="1.0"
      >> encoding="UTF-8"?>
      >>
      >> <ANALYSISPARAMETERS>
      >> <PARAMETER name="-f1"
      >> value="/Users/gilmanb/sourceforge/omnigene2/omnigene-1.1.3/runtime/jaka
      >> rta-tomcat-4.1.24/webapps/axis/WEB-INF/attachments/Axis53370axis_test1.txt&q
      >> uot;>
      >> <DESCRIPTION>input file 1</DESCRIPTION>
      >> <ATTRIBUTE key="MODE">IN</ATTRIBUTE>
      >> <ATTRIBUTE key="TYPE">FILE</ATTRIBUTE>
      >> <ATTRIBUTE
      >> key="LABEL"></ATTRIBUTE></PARAMETER>
      >> <PARAMETER name="-f2"
      >> value="/Users/gilmanb/sourceforge/omnigene2/omnigene-1.1.3/runtime/jaka
      >> rta-tomcat-4.1.24/webapps/axis/WEB-INF/attachments/Axis53371axis_test2.txt&q
      >> uot;>
      >> <DESCRIPTION>input file 2</DESCRIPTION>
      >> <ATTRIBUTE key="MODE">IN</ATTRIBUTE>
      >> <ATTRIBUTE key="TYPE">FILE</ATTRIBUTE>
      >> <ATTRIBUTE
      >> key="LABEL"></ATTRIBUTE></PARAMETER></ANALYSISPA
      >> RAMETERS>
      >> </parameterInfo>
      >> <parameterInfoArray xsi:type="soapenc:Array"
      >> soapenc:arrayType="ns1:ParmInfo[2]"
      >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      >> <item>
      >> <attributes xsi:type="ns2:Map"
      >> xmlns:ns2="http://xml.apache.org/xml-soap">
      >> <item>
      >> <key xsi:type="xsd:string">MODE</key>
      >> <value xsi:type="xsd:string">IN</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">TYPE</key>
      >> <value xsi:type="xsd:string">FILE</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">LABEL</key>
      >> <value xsi:type="xsd:string"></value>
      >> </item>
      >> </attributes>
      >> <description xsi:type="xsd:string">input file 1</description>
      >> <inputFile xsi:type="xsd:boolean">true</inputFile>
      >> <label xsi:type="xsd:string"></label>
      >> <name xsi:type="xsd:string">-f1</name>
      >> <outputFile xsi:type="xsd:boolean">false</outputFile>
      >> <value
      >> xsi:type="xsd:string">/Users/gilmanb/sourceforge/omnigene2/omnigene-1.1.3/ru
      >> ntime/jakarta-tomcat-4.1.24/webapps/axis/WEB-INF/attachments/Axis53370axis_t
      >> est1.txt</value>
      >> </item>
      >> <item>
      >> <attributes xsi:type="ns3:Map"
      >> xmlns:ns3="http://xml.apache.org/xml-soap">
      >> <item>
      >> <key xsi:type="xsd:string">MODE</key>
      >> <value xsi:type="xsd:string">IN</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">TYPE</key>
      >> <value xsi:type="xsd:string">FILE</value>
      >> </item>
      >> <item>
      >> <key xsi:type="xsd:string">LABEL</key>
      >> <value xsi:type="xsd:string"></value>
      >> </item>
      >> </attributes>
      >> <description xsi:type="xsd:string">input file 2</description>
      >> <inputFile xsi:type="xsd:boolean">true</inputFile>
      >> <label xsi:type="xsd:string"></label>
      >> <name xsi:type="xsd:string">-f2</name>
      >> <outputFile xsi:type="xsd:boolean">false</outputFile>
      >> <value
      >> xsi:type="xsd:string">/Users/gilmanb/sourceforge/omnigene2/omnigene-1.1.3/ru
      >> ntime/jakarta-tomcat-4.1.24/webapps/axis/WEB-INF/attachments/Axis53371axis_t
      >> est2.txt</value>
      >> </item>
      >> </parameterInfoArray>
      >> <resultFileName xsi:type="xsd:string" xsi:nil="true"/>
      >> <status xsi:type="xsd:string">Not Started</status>
      >> <taskID xsi:type="xsd:int">0</taskID>
      >> <userId xsi:type="xsd:string"></userId>
      >> </submitJobReturn>
      >> </ns1:submitJobResponse>
      >> </soapenv:Body>
      >> </soapenv:Envelope>
      >> ==============
      >>
      >>
      >> --
      >> Brian Gilman <gilmanb@...>
      >> Group Leader Medical & Population Genetics Dept.
      >> MIT/Whitehead Inst. Center for Genome Research
      >> One Kendall Square, Bldg. 300 / Cambridge, MA 02139-1561 USA
      >> phone +1 617 252 1069 / fax +1 617 252 1902
      >>
      >> ------ End of Forwarded Message
      >>
      >>
      >> Yahoo! Groups Sponsor
      >>
      >>
      >>
      >> To unsubscribe from this group, send an email to:
      >> soaplite-unsubscribe@yahoogroups.com
      >>
      >>
      >>
      >> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

      --
      Brian Gilman <gilmanb@...>
      Group Leader Medical & Population Genetics Dept.
      MIT/Whitehead Inst. Center for Genome Research
      One Kendall Square, Bldg. 300 / Cambridge, MA 02139-1561 USA
      phone +1 617 252 1069 / fax +1 617 252 1902
    • Show all 4 messages in this topic