Search in sources :

Example 36 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class DispatchClientServerTest method testCreateDispatchWithEPR.

@Test
public void testCreateDispatchWithEPR() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(wsdl);
    SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
    assertNotNull(service);
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.address("http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort");
    builder.serviceName(SERVICE_NAME);
    builder.endpointName(PORT_NAME);
    W3CEndpointReference w3cEpr = builder.build();
    Dispatch<SOAPMessage> disp = service.createDispatch(w3cEpr, SOAPMessage.class, Service.Mode.MESSAGE);
    InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
    SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
    assertNotNull(soapReqMsg);
    SOAPMessage soapResMsg = disp.invoke(soapReqMsg);
    assertNotNull(soapResMsg);
    String expected = "Hello TestSOAPInputMessage";
    assertEquals("Response should be : Hello TestSOAPInputMessage", expected, DOMUtils.getAllContent(SAAJUtils.getBody(soapResMsg)).trim());
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InputStream(java.io.InputStream) SOAPMessage(javax.xml.soap.SOAPMessage) URL(java.net.URL) Test(org.junit.Test)

Example 37 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class BankImpl method createAccountReference.

private W3CEndpointReference createAccountReference(String accountName) {
    String corbaAddress = "corbaname::localhost:1050#" + accountName;
    Object account = new AccountImpl();
    Endpoint ep = Endpoint.publish(corbaAddress, account);
    endpointList.put(accountName, ep);
    return (W3CEndpointReference) ep.getEndpointReference((org.w3c.dom.Element[]) null);
}
Also used : Endpoint(javax.xml.ws.Endpoint) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference)

Aggregations

W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)37 Test (org.junit.Test)17 QName (javax.xml.namespace.QName)9 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)9 URL (java.net.URL)8 InputStream (java.io.InputStream)6 StreamResult (javax.xml.transform.stream.StreamResult)6 EndpointReference (javax.xml.ws.EndpointReference)6 Element (org.w3c.dom.Element)6 Number (org.apache.cxf.factory_pattern.Number)5 NumberFactory (org.apache.cxf.factory_pattern.NumberFactory)5 NumberFactoryService (org.apache.cxf.factory_pattern.NumberFactoryService)5 NumberService (org.apache.cxf.factory_pattern.NumberService)5 Document (org.w3c.dom.Document)5 Source (javax.xml.transform.Source)4 Endpoint (javax.xml.ws.Endpoint)4 ServiceImpl (org.apache.cxf.jaxws.ServiceImpl)4 ArrayList (java.util.ArrayList)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBException (javax.xml.bind.JAXBException)2