You can also read the javascript client support code in CXF to see how to do this.
On Thu, Jun 30, 2011 at 1:19 PM, Aki Yoshida <[email protected]> wrote: > Hi, > as you already described, your xmlhttp instance is not posting a > proper soap message to the cxf service. > I suppose you are not setting up your xmlhttp instance appropriately > for posting a soap message. You can look into the XMLHttpRequest > documentation. > regards, aki > > 2011/6/27 kkwang <[email protected]>: >> Hi all, >> >> I have a CXF-based soap service running on tomcat. I'm trying to invoke its >> service methods from a web page by using XMLHttpRequest. I construct the >> soap request xml and pass the xml string to XMLHttpRequest.send() method. >> For example: >> >> var xml = '<soapenv:Envelope xmlns:app="http://ws.ebizcard.com/app" >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' + >> >> '<soapenv:Body><app:AuthenticateUserType><app:LoginCredential><app:UserEmail>[email protected]</app:UserEmail>' >> + >> >> '<app:Password>test</app:Password></app:LoginCredential></app:AuthenticateUserType></soapenv:Body></soapenv:Envelope>'; >> >> xmlhttp.send(xml); >> >> However, the back-end service blows up with this error message: >> >> Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog >> at [row,col {unknown-source}]: [1,0] >> at >> com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686) >> at >> com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134) >> at >> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040) >> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) >> at >> com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095) >> at >> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:122) >> >> I use Fiddler to capture http traffic and see what's wrong. The http request >> body doesn't seem to contain anything. However, if I construct a raw http >> request in Fiddler and just paste the same xml in the request body, >> everything works fine. Anyone has any idea? >> >> Thanks >> Kang >> >> -- >> View this message in context: >> http://cxf.547215.n5.nabble.com/Can-t-Process-HTTP-request-sent-by-XMLHttpRequest-tp4526853p4526853.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >
