Prev: Blank page when starting tomcat from eclipse
Next: JSP - Servlet related question - Request Help
From: eunever32 on 22 Mar 2010 09:14 Hi I am calling a web service directly via http because I'm using the proxy gateway. So instead of Object object = call.invoke(soapEnvelope) I'm doing HttpClient client client.executeMethod(postMethod) .... And then read the response into a string. My question is: When I examine the response I see: ------=_Part_7_21866603.1269262621509 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-Id: <7CDE7D3D9A8ECEA3A8DDC9F2E22917BB> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http:// .... </soapenv:Envelope> ------=_Part_7_21866603.1269262621509 Content-Type: application/pdf Content-Transfer-Encoding: binary Content-Id: <masterLayout> %PDF-1.3 %ª«¬ 4 0 obj << /Type /Info %%EOF ------=_Part_7_21866603.1269262621509-- Is there some API that I can use to cast the above into an object and then obtain the soap response and attachment? Thanks
From: RedGrittyBrick on 22 Mar 2010 10:25 On 22/03/2010 13:14, eunever32(a)yahoo.co.uk wrote: > Hi > > I am calling a web service directly via http because I'm using the > proxy gateway. > > So instead of Object object = call.invoke(soapEnvelope) > > I'm doing > > HttpClient client > client.executeMethod(postMethod) > ... > And then read the response into a string. > > My question is: > When I examine the response I see: > ------=_Part_7_21866603.1269262621509 > Content-Type: text/xml; charset=UTF-8 > Content-Transfer-Encoding: binary > Content-Id:<7CDE7D3D9A8ECEA3A8DDC9F2E22917BB> > > <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope > xmlns:soapenv="http:// > ... > </soapenv:Envelope> > ------=_Part_7_21866603.1269262621509 > Content-Type: application/pdf > Content-Transfer-Encoding: binary > Content-Id:<masterLayout> > > %PDF-1.3 > %ª«¬ > 4 0 obj > << /Type /Info > %%EOF > > ------=_Part_7_21866603.1269262621509-- > > Is there some API that I can use to cast the above into an object and > then obtain the soap response and attachment? As I see it you have two options: 1) Use a SOAP API for SOAP if you want SOAP-like processing of SOAP objects. Search an archive of this newsgroup for recommendations. It probably wouldn't hurt to try whatever SOAP API seems to be foremost in your IDE. I'd be surprised if any SOAP API couldn't cope with a regular HTTP-proxy (or a Socks proxy) 2) Use HttpClient if you are happy to parse the returned XML using an XML parsing API - I'd use a DOM (not SAX) style API to parse the XML and XPath to extract values but YMMV. Then construct your own objects from the extracted set of values. Approach 1 is the obvious one and I expect most people find it to be easier (assuming you have WSDL, XSD etc). Which SOAP (web-services) API had you tried and found to lack proxy support? -- RGB
From: Tom Anderson on 22 Mar 2010 12:03 On Mon, 22 Mar 2010, eunever32(a)yahoo.co.uk wrote: > I am calling a web service directly via http because I'm using the proxy > gateway. A reputable SOAP library will handle proxies. You don't have to do it yourself. Can you use Metro, aka the JAX-WS reference implementation, which comes as part of the JDK for 1.6 onwards and is a separate download for 1.4 and 1.5? If you're starting from WSDL, you can; not sure whether you can if you're not. Metro uses java's standard HttpConnection for its connections, and that can use proxies; you configure this using system properties, or some other mechanisms: http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html tom -- Hubo un vez, un gran rev que tenia muchas tierra un Castillo y tambien un amor.
From: Arne Vajhøj on 22 Mar 2010 17:58 On 22-03-2010 09:14, eunever32(a)yahoo.co.uk wrote: > I am calling a web service directly via http because I'm using the > proxy gateway. I would be very surprised if your web service toolkit does not support proxies. > My question is: > When I examine the response I see: > ------=_Part_7_21866603.1269262621509 > Content-Type: text/xml; charset=UTF-8 > Content-Transfer-Encoding: binary > Content-Id:<7CDE7D3D9A8ECEA3A8DDC9F2E22917BB> > > <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope > xmlns:soapenv="http:// > ... > </soapenv:Envelope> > ------=_Part_7_21866603.1269262621509 > Content-Type: application/pdf > Content-Transfer-Encoding: binary > Content-Id:<masterLayout> > > %PDF-1.3 > %���� > 4 0 obj > << /Type /Info > %%EOF > > ------=_Part_7_21866603.1269262621509-- > > Is there some API that I can use to cast the above into an object and > then obtain the soap response and attachment? I really believe that you should use a web service toolkit to make the call. But even if not then I would expect a web service toolkit to have some parsing classes that you can reuse in your code for the SOAP part. Only as last resort go to pure W3C DOM. The attachment is easy. That is just taking everything between the two blank lines and stuff it in a file. Arne
|
Pages: 1 Prev: Blank page when starting tomcat from eclipse Next: JSP - Servlet related question - Request Help |