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

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



Interesting format. Dump to file and treat as new type integrating email-like multi-part message processing, XML processing, and file parsing? 

If you know this is THE format, dirty version would be to parse the file for "retrievalName" and then find the next mime boundary and dump binary data into new file (retrievalName).

Of course, first you have to get the service to send you something. The HTTPAPI log doesn't appear to show a successful invocation.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Spencer Wofford
Sent: Tuesday, October 04, 2011 8:57 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Using HTTPAPI to access webservice that uses XML-XOP and MTOM

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="<v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx<mailto: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: <v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx<mailto:v0-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx>>

<?xml version="1.0" encoding="UTF-8"?><e:Envelope xmlns:d="http://www.w3.org/2001/XMLSchema"; xmlns:i="http://www.w3.org/2001/XMLSchema-instance"; xmlns:fn35d="http://www.filenet.com/ns/fnce/2005/02/ws/DIME/schema"; xmlns:fn35="http://www.filenet.com/ns/fnce/2005/02/ws/schema"; xmlns:fn40d="http://www.filenet.com/ns/fnce/2006/11/ws/DIME/schema"; xmlns:fn40m="http://www.filenet.com/ns/fnce/2006/11/ws/MTOM/schema"; xmlns:fn40="http://www.filenet.com/ns/fnce/2006/11/ws/schema"; xmlns:dime="http://schemas.xmlsoap.org/ws/2002/04/reference/"; xmlns:xop="http://www.w3.org/2004/08/xop/include"; xmlns:e="http://www.w3.org/2003/05/soap-envelope";><e:Body><GetContentResponse xmlns="http://www.filenet.com/ns/fnce/2006/11/ws/schema";><ContentResponse 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}"></SourceSpecification><ElementSpecification elementSequenceNumber="0"></ElementSpecification><Content i:type="fn40:InlineContent"><Binary><xop:Include href="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: <v1-8d32660b356a0d01-132cb121834@xxxxxxxxxxxxxxxxxxxxx<mailto: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: 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="http://www.filenet.com/ns/fnce/2006/11/ws/schema"; xmlns:soap="http://www.w3.org/2003/05/soap-envelope";>
   <soap:Header>
      <wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
         <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
            <wsse:Username>*</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>*</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary";>MjAxMTEwMDQwODAxNTgwMDMwMDA1NTc1</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@01CC8273.8E02CD60]




________________________________
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.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------