Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: axis and soap from javascript ? [Thread Next] Re: axis and soap from javascript ?To: NULL Date: 4/9/2004 1:13:00 PM Well, it looks like I need to put on some special SOAP headers to successfully talk to the web service. *** If this is true, do I have to construct those soap headers by **** hand ? Or is there a javascript library I can use to **** do it more conveniently ? If I have to do it by hand, do the following errors help you help me figure out what I'm doing wrong ? If I do basically what you show below, the xml I get back looks like this if I don't put in any SOAP headers: <?xml version="1.0"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault> <faultcode>soapenv:Server.userException</faultcode> <faultstring>org.xml.sax.SAXException: Bad envelope tag: TEST_REQUEST</faultstring> <detail/> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope> If I put in a header equivalent to the one that was used for delivering that error message to me, I get this: <?xml version="1.0"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault> <faultcode>soapenv:Server.userException</faultcode> <faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.</faultstring> <detail/> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope> Any ideas about this ????? Thanks. /Eric > Hi...Here's an example of using Microsoft's implimentation XMLHTTP. > You'll want to do a lot more reading up about it...consider going down > to your local full-service bookstore, or looking for a text on line, or > <gasp/> googling for more info...but this will get you started: > > var XMLHTTP = new ActiveXObject( 'Msxml2.XMLHTTP' ); > > var XMLRequest = new ActiveXObject( 'Msxml2.DOMDocument' ); > var XMLResponse; > > var method = 'POST'; > var async = false; > > // TODO: Change the string in the next line to whatever xml you need to > send... > var xmlString ='<root><content>Here is some text</content></root>'; > > // TODO: Change the next line to the web address of the server you are > // trying to get information from > var url = 'http://localhost/server.asp'; > > var bSuccessfullyLoaded = XMLRequest.loadXML( xmlString); > > if( bSuccessfullyLoaded ) > { > debugger; > XMLHTTP.Open( method, url, async ); > XMLHTTP.Send( xmlString ); > XMLResponse = XMLHTTP.responseXML; > > if( 0 == XMLResponse.parseError.errorCode ) > { > // TODO: Do something useful here once you > // successfully get a response... > window.alert( XMLResponse.xml ); > } > else > { > // TODO: Handle the parsing error here > window.alert('A Parse Error'); > } > } > > > Good Luck! > > --Geoff McGrath > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
