Search in sources :

Example 26 with RequestWrapper

use of javax.xml.ws.RequestWrapper in project cxf by apache.

the class CodeGenTest method testHelloWorldSoap12.

@Test
public void testHelloWorldSoap12() throws Exception {
    env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_soap12.wsdl"));
    processor.setContext(env);
    processor.execute();
    assertNotNull(output);
    File org = new File(output, "org");
    assertTrue(org.exists());
    File apache = new File(org, "apache");
    assertTrue(apache.exists());
    File cxf = new File(apache, "cxf");
    assertTrue(cxf.exists());
    File w2j = new File(cxf, "w2j");
    assertTrue(w2j.exists());
    File helloworldsoaphttp = new File(w2j, "hello_world_soap12_http");
    assertTrue(helloworldsoaphttp.exists());
    File types = new File(helloworldsoaphttp, "types");
    assertTrue(types.exists());
    File[] files = helloworldsoaphttp.listFiles();
    assertEquals(5, files.length);
    files = types.listFiles();
    assertEquals(7, files.length);
    Class<?> clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_soap12_http.Greeter");
    assertTrue("class " + clz.getName() + " modifier is not public", Modifier.isPublic(clz.getModifiers()));
    assertTrue("class " + clz.getName() + " modifier is interface", Modifier.isInterface(clz.getModifiers()));
    WebService webServiceAnn = AnnotationUtil.getPrivClassAnnotation(clz, WebService.class);
    assertEquals("Greeter", webServiceAnn.name());
    Method method = clz.getMethod("sayHi", new Class[] {});
    WebMethod webMethodAnno = AnnotationUtil.getPrivMethodAnnotation(method, WebMethod.class);
    if (webMethodAnno.operationName() != null && !"".equals(webMethodAnno.operationName())) {
        assertEquals(method.getName() + "()" + " Annotation : WebMethod.operationName ", "sayHi", webMethodAnno.operationName());
    }
    RequestWrapper requestWrapperAnn = AnnotationUtil.getPrivMethodAnnotation(method, RequestWrapper.class);
    assertEquals("org.apache.cxf.w2j.hello_world_soap12_http.types.SayHi", requestWrapperAnn.className());
    ResponseWrapper resposneWrapperAnn = AnnotationUtil.getPrivMethodAnnotation(method, ResponseWrapper.class);
    assertEquals("sayHiResponse", resposneWrapperAnn.localName());
    WebResult webResultAnno = AnnotationUtil.getPrivMethodAnnotation(method, WebResult.class);
    assertEquals("responseType", webResultAnno.name());
    method = clz.getMethod("pingMe", new Class[] {});
    webMethodAnno = AnnotationUtil.getPrivMethodAnnotation(method, WebMethod.class);
    if (webMethodAnno.operationName() != null && !"".equals(webMethodAnno.operationName())) {
        assertEquals(method.getName() + "()" + " Annotation : WebMethod.operationName ", "pingMe", webMethodAnno.operationName());
    }
    Class<?>[] exceptionCls = method.getExceptionTypes();
    assertEquals(1, exceptionCls.length);
    assertEquals("org.apache.cxf.w2j.hello_world_soap12_http.PingMeFault", exceptionCls[0].getName());
}
Also used : WebMethod(javax.jws.WebMethod) WebService(javax.jws.WebService) RequestWrapper(javax.xml.ws.RequestWrapper) ResponseWrapper(javax.xml.ws.ResponseWrapper) ObjectStreamClass(java.io.ObjectStreamClass) Method(java.lang.reflect.Method) WebMethod(javax.jws.WebMethod) WebResult(javax.jws.WebResult) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Example 27 with RequestWrapper

use of javax.xml.ws.RequestWrapper in project narayana by jbosstm.

the class ParticipantPortTypeImpl method readonly.

/**
 */
@WebMethod(operationName = "Readonly", action = "http://www.wstf.org/docs/scenarios/sc007/Readonly")
@Oneway
@Action(input = "http://www.wstf.org/docs/scenarios/sc007/Readonly")
@RequestWrapper(localName = "Readonly", targetNamespace = "http://www.wstf.org/sc007", className = "com.jboss.transaction.wstf.webservices.sc007.generated.TestMessageType")
public void readonly() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ParticipantProcessor.getParticipant().readonly(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Example 28 with RequestWrapper

use of javax.xml.ws.RequestWrapper in project narayana by jbosstm.

the class ParticipantPortTypeImpl method retryCommit.

/**
 */
@WebMethod(operationName = "RetryCommit", action = "http://www.wstf.org/docs/scenarios/sc007/RetryCommit")
@Oneway
@Action(input = "http://www.wstf.org/docs/scenarios/sc007/RetryCommit")
@RequestWrapper(localName = "RetryCommit", targetNamespace = "http://www.wstf.org/sc007", className = "com.jboss.transaction.wstf.webservices.sc007.generated.TestMessageType")
public void retryCommit() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ParticipantProcessor.getParticipant().retryCommit(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Example 29 with RequestWrapper

use of javax.xml.ws.RequestWrapper in project narayana by jbosstm.

the class ParticipantPortTypeImpl method earlyAborted.

/**
 */
@WebMethod(operationName = "EarlyAborted", action = "http://www.wstf.org/docs/scenarios/sc007/EarlyAborted")
@Oneway
@Action(input = "http://www.wstf.org/docs/scenarios/sc007/EarlyAborted")
@RequestWrapper(localName = "EarlyAborted", targetNamespace = "http://www.wstf.org/sc007", className = "com.jboss.transaction.wstf.webservices.sc007.generated.TestMessageType")
public void earlyAborted() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ParticipantProcessor.getParticipant().earlyAborted(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Example 30 with RequestWrapper

use of javax.xml.ws.RequestWrapper in project narayana by jbosstm.

the class InitiatorPortTypeImpl method response.

/**
 */
@WebMethod(operationName = "Response", action = "http://www.wstf.org/docs/scenarios/sc007/Response")
@Oneway
@Action(input = "http://www.wstf.org/docs/scenarios/sc007/Response")
@RequestWrapper(localName = "Response", targetNamespace = "http://www.wstf.org/sc007", className = "com.jboss.transaction.wstf.webservices.sc007.generated.TestMessageType")
public void response() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    InitiatorProcessor.getInitiator().handleResponse(inboundMap);
}
Also used : MessageContext(javax.xml.ws.handler.MessageContext) MAP(org.jboss.ws.api.addressing.MAP) WebMethod(javax.jws.WebMethod) Action(javax.xml.ws.Action) Oneway(javax.jws.Oneway) RequestWrapper(javax.xml.ws.RequestWrapper)

Aggregations

RequestWrapper (javax.xml.ws.RequestWrapper)50 Action (javax.xml.ws.Action)41 MessageContext (javax.xml.ws.handler.MessageContext)41 MAP (org.jboss.ws.api.addressing.MAP)41 SoapFault11 (com.arjuna.webservices11.SoapFault11)38 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)38 WebMethod (javax.jws.WebMethod)10 Method (java.lang.reflect.Method)7 File (java.io.File)4 Oneway (javax.jws.Oneway)4 AbstractCodeGenTest (org.apache.cxf.tools.wsdlto.AbstractCodeGenTest)4 Test (org.junit.Test)4 ObjectStreamClass (java.io.ObjectStreamClass)2 WebParam (javax.jws.WebParam)2 WebResult (javax.jws.WebResult)2 WebService (javax.jws.WebService)2 QName (javax.xml.namespace.QName)2 ResponseWrapper (javax.xml.ws.ResponseWrapper)2 Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1