Hello List, I've got a problem with Axis2/XmlBeans/WSDL2Java. The build up is as follow:
I use WSDL2Java to generate the Java classes. This works pretty good. My WSDL file looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.4-b01-. --> <definitions targetNamespace="http://test.bug.axis2/" name="Axis2BugTestWSService" xmlns:tns="http://test.bug.axis2/" xmlns:samla="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema> <xsd:import namespace="urn:oasis:names:tc:SAML:2.0:assertion" schemaLocation="saml-schema-assertion-2.0.xsd"/> <xsd:import namespace="urn:oasis:names:tc:SAML:2.0:protocol" schemaLocation="saml-schema-protocol-2.0.xsd"/> </xsd:schema> </types> <message name="buh"> <part name="parameters" element="samlp:AuthnRequest"/> </message> <message name="buhResponse"> <part name="parameters" element="samla:Assertion"/> </message> <portType name="Axis2BugTestWS"> <operation name="buh"> <input message="tns:buh"/> <output message="tns:buhResponse"/> </operation> </portType> <binding name="Axis2BugTestWSPortBinding" type="tns:Axis2BugTestWS"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <operation name="buh"> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="Axis2BugTestWSService"> <port name="Axis2BugTestWSPort" binding="tns:Axis2BugTestWSPortBinding"> <soap:address location="http://localhost:8080/axis2/services/Axis2BugTestWSService"/> </port> </service> </definitions> I also generate the clientstubs. The operation buh is implemented as follow: public class BuhService extends Axis2BugTestWSServiceSkeleton { private static final transient Logger LOG = Logger.getLogger(BuhService. class); @Override public AssertionDocument buh(AuthnRequestDocument authnRequest) { LOG.info("in buh"); try { LOG.fatal("envelope: " + MessageContext. getCurrentMessageContext().getEnvelope()); }catch(final Exception e) { LOG.fatal("aargh", e); } final AssertionDocument ad = AssertionDocument.Factory.newInstance(); ad.addNewAssertion(); return ad; } } So everything is pretty straight forward and there is nothing special. When I deploy the service to the Axis container everything works fine. And even when I access the web service over a generic SOAP client (SOAP UI) with the following request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:protocol"> <Subject xmlns="urn:oasis:names:tc:SAML:2.0:assertion"> <NameID>testuser4</NameID> <SubjectConfirmation> <SubjectConfirmationData>password4</SubjectConfirmationData> </SubjectConfirmation> </Subject> </AuthnRequest> </soapenv:Body> </soapenv:Envelope> the service acts as desired. I see the envelope of the message context in my logging without the body (because the stream is consumed by xmlbeans for creating the input objects ?!). The problem now is when I try to use the clientstub with exactly the same request (checked via tcp monitor) and the following Java code: public static void main(final String[] args) { LOG.info("running"); try { final Axis2BugTestWSServiceStub s = new Axis2BugTestWSServiceStub( "http://localhost:8080/axis2/services/Axis2BugTestWSService"); final AuthnRequestDocument ard = AuthnRequestDocument.Factory. newInstance(); final AuthnRequestType request = ard.addNewAuthnRequest(); request.addNewSubject().addNewNameID().setStringValue("testuser4"); request.getSubject().addNewSubjectConfirmation(). addNewSubjectConfirmationData().set(XmlString.Factory. newValue("password4")); LOG.info("request: " + ard); System.out.println(s.buh(ard)); }catch(final Exception e) { LOG.fatal("crashed: " + e); } } I can't access the envelope in the messageContext or any of its child objects in the service implementation you saw earlier. Every try results in the following Exception: org.apache.axiom.om.OMException: java.util.NoSuchElementException at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249) at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:633) at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:650) at org.apache.axiom.om.impl.llom.OMElementImpl.getChildren(OMElementImpl.java:323) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:903) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:375) at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:1051) at java.lang.String.valueOf(String.java:2827) at java.lang.StringBuilder.append(StringBuilder.java:115) at bug.BuhService.buh(BuhService.java:33) at axis2.bug.test.Axis2BugTestWSServiceMessageReceiverInOut.invokeBusinessLogic(Axis2BugTestWSServiceMessageReceiverInOut.java:48) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.util.NoSuchElementException at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1083) at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161) ... 34 more My Environment is: *Axis2* 1.4.1 Tomcat6 WSDL 1.1 XMLBeans 2.2.0 Ubuntu 8.04 <http://2.2.0.> Maybe I'm doing something wrong or using something in a strange/inappropriate way. I hope my example was simple and understandable. I would highly appreciate every reply to solve this problem. Maybe somebody can give me a little background to understand this behaviour or appropriated links to resources. Thanks a lot in advance Cheers Sebastian --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
