Scott, Thank you for all your help. I made the change in the WO SOAP Server and now my parsing works!
Sharon -------------------- From: Scott Nichol <[EMAIL PROTECTED]> Date: Fri Jun 14, 2002 10:36:24 AM US/Pacific To: [EMAIL PROTECTED] Subject: Re: Webobjects and SOAP Reply-To: [EMAIL PROTECTED] The response is improperly formed XML. This is caused by a bug in Main.wod: XMLNode4: WOXMLNode { elementName = "r:SingleEndpoint"; mustUnderStand = "1"; "xmlns:SingleEndpoint" = "http://vendor.demo/endpoint"; "xsi:type" = "xsd:int"; } The line "xmlns:SingleEndpoint" = "http://vendor.demo/endpoint"; should be "xmlns:r" = "http://vendor.demo/endpoint"; Scott Nichol ----- Original Message ----- From: "Lui" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 14, 2002 1:13 PM Subject: Re: Webobjects and SOAP Scott, Thank you for your detail response. I did find out that the reason I was gettting the 411 SOAPFault was because I was missing the appropriate DirectAction in my URL . The SOAP server runs on the WO java app server. I am testing with the sample Server as a learning exercise. As you said, I am having errors in parsing the SOAP Response due to the returning header. I am using this chunk of code to display the elements from the SOAPResponse: // Get DocumentBuilder to parse Response xdb = XMLParserUtils.getXMLDocBuilder(); // Use input XML file as InputSource to parse() InputSource is = new InputSource(br); doc = xdb.parse(is); // Get the Root Element and print it Element elem = doc.getDocumentElement(); System.out.println("Root Element is: " + elem.getTagName()); // Get all of the Child Elements and print them one by one NodeList children = elem.getElementsByTagName("*"); int cnt = children.getLength(); for (int i = 0; i < cnt; i++) { Node n = children.item(i); String name = n.getNodeName(); String val = n.getFirstChild().getNodeValue(); System.out.println(name + ": " + val); } The resulting SOAPResponse looks like this: XML SOAPResponse Document: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding"><SOAP-ENV: Header><r:SingleEndpoint mustUnderStand="1" xmlns:SingleEndpoint="http://vendor.demo/endpoint" xsi:type="xsd:int">0</r:SingleEndpoint></SOAP-ENV:Header><SOAP-ENV:Body><m:O rderResponse xmlns:m="http://vendor.demo/demo/response"><ConfirmationNumber>E1114964844</ ConfirmationNumber></m:OrderResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> Getting error: XML SOAPResponse Document: [Fatal Error] :2:268: The prefix "r" for element "r:SingleEndpoint" is not bound. Exception in thread "main" org.xml.sax.SAXParseException: The prefix "r" for element "r:SingleEndpoint" is not bound. at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:20 1) at POClient.sendSoapRequest(POClient.java:131) at POClient.main(POClient.java:165) Sharon ------------------------- ---------------- From: Scott Nichol <[EMAIL PROTECTED]> Date: Thu Jun 13, 2002 07:57:46 PM US/Pacific To: [EMAIL PROTECTED] Subject: Re: Webobjects and SOAP Reply-To: [EMAIL PROTECTED] Some things I see from Apple's source. 1. The 411 fault comes from DirectAction#defaultAction. This means your Apache SOAP client is not using the correct URL. It must use http://server[:port]/cgi-bin/WebObjects/SOAPServer.woa/wa/OrderInterface (SOAPTransport.java). 2. The WO SOAP server determines the service to invoke from that URL, so it does not make any difference what your client specifies as the target URI. 3. The namespace used for the method and parameters sent by the client (SOAPBuilder.java) is http://wwdc-demo.apple.com/soap/request/, but the server (Main.java) ignores this. The method is named Order. The parameters are named OrderItems, CustomerID and BillMethod. 4. The response (Main.wod, Main.html) has a SOAP Header with an element that has a mustUnderstand="1" attribute, which *should* be a problem, but maybe Apache SOAP ignores this. The SOAP Body has an OrderResponse element in the namespace http://vendor.demo/demo/response, which itself contains an element named ConfirmationNumber. This does not have an xsi:type attribute, so you will need to use the Apache SOAP mapping workaround for this. The bottom line is that it should be possible to write an Apache SOAP client that will work with this server, but I personally would not recommend using the server sample as a template for implementing SOAP services, since so much is hard-coded and the SOAP implementation is lacking. IMHO, you would be better off using Apache SOAP in the J2EE application server that is part of WO 5.x. Scott Nichol ----- Original Message ----- From: "Scott Nichol" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 13, 2002 10:01 PM Subject: Re: Webobjects and SOAP Sharon, I see the source is on Apple's Web site, e.g. http://developer.apple.com/samplecode/Sample_Code/WebObjects/SOAPClient/SOAP Tran sport.java.htm. Can you post the source for your client so I can have a look? Thanks. Scott Nichol ----- Original Message ----- From: "Scott Nichol" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 13, 2002 9:51 PM Subject: Re: Webobjects and SOAP Sharon, Did you get any response to this? I have experience with WO 4, but not 5.x and the sample SOAP server. Does Apple provide any sample client code for the SOAP server? If so, it would be useful to either look at that source or run the client and capture the data sent over the weire. If not, is source provided for the SOAP server? Out of curiosity, does the SOAP server run on the J2EE app server or the WO Java app server? Scott Nichol ----- Original Message ----- From: "Lui" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 12, 2002 5:45 PM Subject: Webobjects and SOAP Greetings, I am new to SOAP. I am trying to write an apache SOAP client sending SOAPRequests to the sample SOAP server that comes with WebObjects 5.1. I just keep giving the 411 SOAPFault Response. I need some help. If you are familiar with WebObjects and willing to take a look at what I have so far, could you send me a response? Thanks in advance for your help. Sharon [EMAIL PROTECTED] __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com