[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using HTTPAPI to access webservice that uses XML-XOP and MTOM



Spencer,

Do I correctly assume that you want to decode the MIME message that you 
received from the server on your System i?

If that is true you may consider to send to me a sample MIME message (as 
received by soapUI) and I try to get it through my MIME parser. Feel free 
to send it as private mail to my tools400 email address.

Or you may download my WSDL2RPG and let it generate a RPG stub for you. The 
MIME parser is included.

Thomas.

Am 04.10.2011 15:56, schrieb Spencer Wofford:
>
>     I have utilized the HTTPAPI to access many types of web service but I
>     have come across one that I have not seen before.
>
>     XML-XOP using MTOM. (XML binary Optimized packaging using Message
>     Transmission Optimization Mechanism.)
>
>     The webservice that I am trying to access is IBM's Filenet P8
>     Enterprise File Storage System, which stores all kinds of files such
>     as TIFF, PDF, etc...
>
>     There is a web service that allows you to specify an object ID and
>     retrieve the binary contents of a file that has been stored in the
>     system(called getContent).
>
>     I am pretty sure that the service program HTTPAPI was not designed to
>     handle this branch of the SOAP/XML standards.
>
>
>     Has anyone run across this format before and have any alternative
>     approaches or is there some procedure in httpapi I am missing?  The
>     output looks similar to email multi-boundary content.
>
>
>
>     (I used SOAPUI to make a request for a document and here is the output
>     from that)
>
>     HTTP/1.1 200 OK
>
>     SOAPAction: ""
>
>     User-Agent: IBM FileNet P8 CE Java API (5.0.0 / dap452.227)
>
>     Content-Type: multipart/related;
>     boundary=A-B--MIME-BOUNDARY--8d32660b356a0d01-132cb121834--Y-Z;
>     type="application/xop+xml"; start-info="application/soap+xml";
>     start="<[1]v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx>"
>
>     Content-Language: en-US
>
>     Transfer-Encoding: chunked
>
>     Date: Mon, 03 Oct 2011 18:35:53 GMT
>
>     Server: WebSphere Application Server/7.0
>
>
>     --A-B--MIME-BOUNDARY--8d32660b356a0d01-132cb121834--Y-Z
>
>     Content-Transfer-Encoding: binary
>
>     Content-Type: application/xop+xml; type="application/soap+xml";
>     charset=UTF-8
>
>     Content-ID:<[2]v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx>
>
>
>     <?xml version="1.0" encoding="UTF-8"?><e:Envelope
>     xmlns:d="[3]http://www.w3.org/2001/XMLSchema";
>     xmlns:i="[4]http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:fn35d="[5]http://www.filenet.com/ns/fnce/2005/02/ws/DIME/schema";
>     xmlns:fn35="[6]http://www.filenet.com/ns/fnce/2005/02/ws/schema";
>     xmlns:fn40d="[7]http://www.filenet.com/ns/fnce/2006/11/ws/DIME/schema";
>     xmlns:fn40m="[8]http://www.filenet.com/ns/fnce/2006/11/ws/MTOM/schema";
>     xmlns:fn40="[9]http://www.filenet.com/ns/fnce/2006/11/ws/schema";
>     xmlns:dime="[10]http://schemas.xmlsoap.org/ws/2002/04/reference/";
>     xmlns:xop="[11]http://www.w3.org/2004/08/xop/include";
>     xmlns:e="[12]http://www.w3.org/2003/05/soap-envelope";><e:Body><GetCont
>     entResponse
>     xmlns="[13]http://www.filenet.com/ns/fnce/2006/11/ws/schema";><ContentR
>     esponse id="0" i:type="fn40:ContentElementResponse" retrievalName="bol
>     5391047.TIF" totalSize="110228"><SourceSpecification
>     i:type="fn40:ObjectReference" classId="Document"
>     objectId="{9371692C-8F6C-4B3D-A256-761563140763}"
>     objectStore="{1DD06E09-8594-45D3-82E4-6BB7A054D07C}"></SourceSpecifica
>     tion><ElementSpecification
>     elementSequenceNumber="0"></ElementSpecification><Content
>     i:type="fn40:InlineContent"><Binary><xop:Include
>     href="[14]cid:v1-8d32660b356a0d01-132cb121834@mtom.p8ce.filenet.com"><
>     /xop:Include></Binary></Content></ContentResponse></GetContentResponse
>     ></e:Body></e:Envelope>
>
>     --A-B--MIME-BOUNDARY--8d32660b356a0d01-132cb121834--Y-Z
>
>     Content-Transfer-Encoding: binary
>
>     Content-Type: application/octet-stream
>
>     Content-Id:
>     <[15]v1-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx>
>
>
>     **Bunch of binary data from here that represents the actual file
>     contents, does not look like base64 encoding because there are
>     non-displayable characters**
>
>
>
>
>
>
>     I tried connecting to the web service using  http_url_post_xml, and
>     here is the debug log file, I have removed the userid and password
>     from the output.
>
>     HTTPAPI Ver 1.23 released 2008-04-24
>
>     OS/400 Ver V6R1M0
>
>
>     New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819.
>     ProtLoc=0
>
>     http_persist_open(): entered
>
>     http_long_ParseURL(): entered
>
>     DNS resolver retrans: 2
>
>     DNS resolver retry  : 2
>
>     DNS resolver options: x'00000136'
>
>     DNS default domain: cfi-us.com
>
>     DNS server found: 172.16.9.1
>
>     DNS server found: 172.16.9.2
>
>     http_persist_post(): entered
>
>     http_long_ParseURL(): entered
>
>     do_post(): entered
>
>     POST /wsi/FNCEWS40MTOM/ HTTP/1.1
>
>     Host: 172.20.12.24:9080
>
>     User-Agent: http-api/1.23
>
>     Content-Type: text/xml; charset=utf-8
>
>     Expect: 100-continue
>
>     Content-Length: 32000
>
>     SOAPAction:
>     [16]http://www.filenet.com/ns/fnce/2006/11/ws/MTOM#GetContent
>
>
>
>     recvresp(): entered
>
>     HTTP/1.1 100 Continue
>
>     Content-Length: 0
>
>     Date: Tue, 04 Oct 2011 13:01:57 GMT
>
>     Server: WebSphere Application Server/7.0
>
>
>
>     SetError() #13: HTTP/1.1 100 Continue
>
>     senddoc(): entered
>
>     <soap:Envelope
>     xmlns:sch="[17]http://www.filenet.com/ns/fnce/2006/11/ws/schema";
>     xmlns:soap="[18]http://www.w3.org/2003/05/soap-envelope";>
>
>        <soap:Header>
>
>           <wsse:Security soap:mustUnderstand="true"
>     xmlns:wsse="[19]http://docs.oasis-open.org/wss/2004/01/oasis-200401-ws
>     s-wssecurity-secext-1.0.xsd">
>
>              <wsse:UsernameToken wsu:Id="UsernameToken-1"
>     xmlns:wsu="[20]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss
>     -wssecurity-utility-1.0.xsd">
>
>                 <wsse:Username>*</wsse:Username>
>
>                 <wsse:Password
>     Type="[21]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-user
>     name-token-profile-1.0#PasswordText">*</wsse:Password>
>
>                 <wsse:Nonce
>     EncodingType="[22]http://docs.oasis-open.org/wss/2004/01/oasis-200401-
>     wss-soap-message-security-1.0#Base64Binary">MjAxMTEwMDQwODAxNTgwMDMwMD
>     A1NTc1</wsse:Nonce>
>
>                 <wsu:Created>2011-10-04T13:01:58Z</wsu:Created>
>
>              </wsse:UsernameToken>
>
>           </wsse:Security>
>
>           <sch:Localization>
>
>              <sch:Locale>en-US</sch:Locale>
>
>           </sch:Localization>
>
>        </soap:Header>
>
>        <soap:Body>
>
>           <sch:GetContentRequest validateOnly="true">
>
>              <sch:ContentRequest cacheAllowed="true" id="0"
>     maxBytes="1000000" startOffset="0">
>
>                 <sch:SourceSpecification classId="Document"
>     objectId="{9371692C-8F6C-4B3D-A256-761563140763}"
>     objectStore="TestOS1" serializationDuplicate="true"/>
>
>                 <sch:ElementSpecification elementSequenceNumber="0"
>     itemIndex="0"/>
>
>              </sch:ContentRequest>
>
>           </sch:GetContentRequest>
>
>        </soap:Body>
>
>     </soap:Envelope>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>     recvresp(): entered
>
>     SetError() #43: CommTCP_read: No 100-Continue (error ignored)
>
>     http_close(): entered
>
>     <eof>
>
>
>
>     I am not sure if image attachments will post properly to the message
>     board but here is a small screen shot sample of the binary data from
>     soapUI.  This is the very start of the data.
>
>     cid:image001.png@01CC826D.E2E61F40
>
>
>
>       _________________________________________________________________
>
>     This e-mail and any files transmitted with it are confidential and
>     solely for the use of the individual or entity to which they are
>     addressed and intended. If you have received this e-mail in error,
>     please notify the sender by return e-mail. If you are not the intended
>     recipient, you may not read, copy, retain, print, disclose, or
>     distribute this message or its contents to any other individual, for
>     such actions may be unlawful.
>     WARNING: We take certain precautions to prevent viruses, but we are
>     not responsible for loss or damage arising from the use of this e-mail
>     or attachments.
>
> References
>
>     1. mailto:v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx
>     2. mailto:v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx
>     3. http://www.w3.org/2001/XMLSchema
>     4. http://www.w3.org/2001/XMLSchema-instance
>     5. http://www.filenet.com/ns/fnce/2005/02/ws/DIME/schema
>     6. http://www.filenet.com/ns/fnce/2005/02/ws/schema
>     7. http://www.filenet.com/ns/fnce/2006/11/ws/DIME/schema
>     8. http://www.filenet.com/ns/fnce/2006/11/ws/MTOM/schema
>     9. http://www.filenet.com/ns/fnce/2006/11/ws/schema
>    10. http://schemas.xmlsoap.org/ws/2002/04/reference/
>    11. http://www.w3.org/2004/08/xop/include
>    12. http://www.w3.org/2003/05/soap-envelope
>    13. http://www.filenet.com/ns/fnce/2006/11/ws/schema
>    14. cid:v1-8d32660b356a0d01-132cb121834@mtom.p8ce.filenet.com
>    15. mailto:v1-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx
>    16. http://www.filenet.com/ns/fnce/2006/11/ws/MTOM#GetContent
>    17. http://www.filenet.com/ns/fnce/2006/11/ws/schema
>    18. http://www.w3.org/2003/05/soap-envelope
>    19. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
>    20. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
>    21. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
>    22. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary
>
>
>
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------