Any chance you can create a small sample that shows the problem with the generated messages? Without a sample, I'm really not sure what I can suggest.
Dan On Aug 22, 2012, at 10:26 PM, kbabushkin <[email protected]> wrote: > Hello, > > I'm using Apache CXF (2.6.1) in my java application to consume 3rd party Web > Service. But I have a problem with it, in particular if I use JAXB for > databinding while stubs generation my client will always send requests with > "header" like "--uuid:e47f145b-38f7-4402-8eec-657d71bc8ad4..." (see client > request below), i.e. besides XML part there is some special info... > > It looks like this special info causes error reply from server "Content is > not allowed in prolog" (see server response below), i.e. server is not > expecting such body. What is interesting here is that if I generate stubs > using XMLBEANS for databinding everything starts to work just fine (and > there is no such "special" info in request body, only XML). After some > googling I suspect that my client for some reason tries to use MTOM (with > JAXB) and I don't know how to turn it off. I've already tried the following > to turn MTOM off (with no luck): > > ((BindingProvider)port).getRequestContext().put("mtom-enabled", > Boolean.FALSE); > ((BindingProvider)port).getRequestContext().put("write.attachments", > Boolean.FALSE); > ((BindingProvider)port).setMTOMEnabled(false); > > Please help I would really want to move to JAXB since it's much more compact > in comparison with XMLBEANS... > > *Client code:* > > AdminServiceV2 ws = new AdminServiceV2(); > AdminV2 port = ws.getAdminPortV2(); > > Client client = ClientProxy.getClient(port); > HTTPConduit http = (HTTPConduit) client.getConduit(); > > AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy(); > authorizationPolicy.setUserName("user1"); > authorizationPolicy.setPassword("password1"); > authorizationPolicy.setAuthorizationType("Basic"); > http.setAuthorization(authorizationPolicy); > > try { > port.getUsersInfo("user1"); > } catch (Exception e) { > e.printStackTrace(); > } > > *Client request:* > > --uuid:e47f145b-38f7-4402-8eec-657d71bc8ad4 > Content-Type: text/xml; charset=UTF-8; type="text/xml"; > Content-Transfer-Encoding: binary > Content-ID: <[email protected]> > > <soap:Envelope > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getUsersInfo > xmlns:ns2="http://service.admin.ws.five9.com/v2/"><userNamePattern>user1</userNamePattern></ns2:getUsersInfo></soap:Body></soap:Envelope> > --uuid:e47f145b-38f7-4402-8eec-657d71bc8ad4-- > > *Server response:* > > <env:Envelope > xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><env:Fault > xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><faultcode>env:Client</faultcode><faultstring>org.xml.sax.SAXParseException: > Content is not allowed in > prolog.</faultstring></env:Fault></env:Body></env:Envelope> > > Thanks, > Konstantin > > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Apache-CXF-2-6-1-Client-gets-Content-is-not-allowed-in-prolog-tp5713009.html > Sent from the cxf-dev mailing list archive at Nabble.com. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
