On Tue, 2007-07-24 at 18:22 -0500, Moore, Greg wrote:
> Hi, 
> 
> Done some searching of httpclient, axis, jython and other lists as well
> as google searches and I haven't come up with anything that explained
> what I am wondering about. Maybe some kind person will take pity on the
> confused. :) 
> 
> I'm posting an xml file containing a soap envelope to a service and I
> get back a xml response that should contain a CDATA element. I'm using
> HttpClient to do this. Below is the essential Jython code that I'm using
> as an example similar to what I'm doing.  I originally was trying to do
> this using Axis but after several days of trying was never successful.
> 
> My question is it possible to handle soap errors and/or faults somehow
> using the method below or do I have to parse xml or is there some way I
> could use axis? 

Greg

I _assume_ one could use Axis2 engine for that end. You'll have a better
luck getting a more detailed answer at the axis-user list, though.

Oleg


> 
>         from org.apache.commons.httpclient import *
>         from org.apache.commons.httpclient.methods import *
>         from java.io import File
> 
>         xmlData = File(xmlFilename)
>         length = xmlData.length()
>         url = "http://myserver.somewhere.com/services/Check.asmx";
>         soapAction = "http://GateWay/Services/CreditCheck/GetReportXml";
>         post = PostMethod(url)
>         entity = FileRequestEntity(xmlData, "text/xml; charset=utf-8")
>         post.addRequestHeader("Content-Length", str(length))
>         post.setRequestEntity(entity)
>         post.addRequestHeader("Content-type", "text/xml; charset=utf-8")
>         post.addRequestHeader("User-Agent", "SQA_TestClient0")
>         post.setRequestHeader("SOAPAction", soapAction)
>         httpClient = HttpClient()
>         statusCode = httpClient.executeMethod(post)
>        if statusCode == HttpStatus.SC_OK:
>                 resultText = post.getResponseBodyAsString()
>        else:
>         # I'd like to check for soap fault here instead of a generic
>               # failure.
>               print " failure: " + post.getStatusLine().toString()
> 
> Thanks in advance,
> Greg Moore
> Software QA
> ADP, Inc.
> 
> 
> 
> This message and any attachments are intended only for the use of the 
> addressee and may contain information that is privileged and confidential. If 
> the reader of the message is not the intended recipient or an authorized 
> representative of the intended recipient, you are hereby notified that any 
> dissemination of this communication is strictly prohibited. If you have 
> received this communication in error, please notify us immediately by e-mail 
> and delete the message and any attachments from your system.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to