Search in sources :

Example 56 with Service

use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.

the class OnewayTester method getHttpStatus.

private int getHttpStatus(String address) throws Exception {
    QName portName = new QName(NS, "OnewayEndpointPort");
    QName serviceName = new QName(NS, "OnewayEndpointService");
    Service service = Service.create(new URL(address + "?wsdl"), serviceName);
    Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    String body = "<ns0:echoInteger xmlns:ns0='" + NS + "'><arg0>12345</arg0></ns0:echoInteger>";
    d.invokeOneWay(new StreamSource(new StringReader(body)));
    Map<String, Object> rc = ((BindingProvider) d).getResponseContext();
    return (Integer) rc.get(MessageContext.HTTP_RESPONSE_CODE);
}
Also used : QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) Service(jakarta.xml.ws.Service) WebService(jakarta.jws.WebService) BindingProvider(jakarta.xml.ws.BindingProvider) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 57 with Service

use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.

the class OnewayTester method verify.

private String verify(String address) throws Exception {
    QName portName = new QName(NS, "OnewayEndpointPort");
    QName serviceName = new QName(NS, "OnewayEndpointService");
    Service service = Service.create(new URL(address + "?wsdl"), serviceName);
    Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    String body = "<ns0:verifyInteger xmlns:ns0='" + NS + "'/>";
    Source response = d.invoke(new StreamSource(new StringReader(body)));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(response, new StreamResult(bos));
    bos.close();
    return new String(bos.toByteArray());
}
Also used : TransformerFactory(javax.xml.transform.TransformerFactory) Transformer(javax.xml.transform.Transformer) StreamResult(javax.xml.transform.stream.StreamResult) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) Service(jakarta.xml.ws.Service) WebService(jakarta.jws.WebService) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 58 with Service

use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.

the class MetadataTester method testDispatchWithMultiplePort.

public void testDispatchWithMultiplePort() throws IOException, SAXException, XMLStreamException {
    Service service = Service.create(JAXWSUtils.getFileOrURL(stsWSDL), new QName("http://tempuri.org/", "SecurityTokenService"));
    Dispatch disp = service.createDispatch(new QName("http://tempuri.org/", "WSHttpBinding_ISecurityTokenService"), (JAXBContext) null, Service.Mode.PAYLOAD);
    assertTrue(disp != null);
    disp = service.createDispatch(new QName("http://tempuri.org/", "WSHttpBinding_ISecurityTokenService1"), (JAXBContext) null, Service.Mode.PAYLOAD);
    assertTrue(disp != null);
    disp = service.createDispatch(new QName("http://tempuri.org/", "CustomBinding_ISecurityTokenService1"), (JAXBContext) null, Service.Mode.PAYLOAD);
    assertTrue(disp != null);
    disp = service.createDispatch(new QName("http://tempuri.org/", "CustomBinding_ISecurityTokenService"), (JAXBContext) null, Service.Mode.PAYLOAD);
    assertTrue(disp != null);
}
Also used : QName(javax.xml.namespace.QName) Service(jakarta.xml.ws.Service) WSDLService(com.sun.xml.ws.api.model.wsdl.WSDLService) Dispatch(jakarta.xml.ws.Dispatch) JAXBContext(jakarta.xml.bind.JAXBContext)

Example 59 with Service

use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.

the class WhitespaceTester method invoke.

private Source invoke(String address) throws Exception {
    QName portName = new QName(NS, "RpcLitPort");
    QName serviceName = new QName(NS, "RpcLitEndpoint");
    Service service = Service.create(new URL(address + "?wsdl"), serviceName);
    Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    String body = "<ns:add xmlns:ns='" + NS + "'>  <arg0> 10 </arg0> <arg1> 20 </arg1> </ns:add>";
    return d.invoke(new StreamSource(new StringReader(body)));
}
Also used : QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) StringReader(java.io.StringReader) Service(jakarta.xml.ws.Service) WebService(jakarta.jws.WebService) URL(java.net.URL) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 60 with Service

use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.

the class ClientEpr method msEprGettertest.

private void msEprGettertest(BindingProvider bp, boolean hasWSDL) throws Exception {
    Service service = Service.create(serviceName);
    service.addPort(portName, jakarta.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
    Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
    // validate ms epr
    MemberSubmissionEndpointReference msEpr = bp.getEndpointReference(MemberSubmissionEndpointReference.class);
    // printEPR(msEpr);
    assertTrue(EprUtil.validateEPR(msEpr, endpointAddress, serviceName, portName, portTypeName, hasWSDL));
    W3CEndpointReference w3cEpr = bp.getEndpointReference(W3CEndpointReference.class);
    // printEPR(w3cEpr);
    // assertTrue(EprUtil.validateEPR(w3cEpr,endpointAddress, serviceName, portName, portTypeName, hasWSDL));
    assertTrue(EprUtil.validateEPR(w3cEpr, endpointAddress, null, null, null, false));
}
Also used : W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) Service(jakarta.xml.ws.Service) Dispatch(jakarta.xml.ws.Dispatch) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference)

Aggregations

Service (jakarta.xml.ws.Service)81 QName (javax.xml.namespace.QName)45 Source (javax.xml.transform.Source)23 StreamSource (javax.xml.transform.stream.StreamSource)21 BindingProvider (jakarta.xml.ws.BindingProvider)17 Dispatch (jakarta.xml.ws.Dispatch)16 URL (java.net.URL)13 StringReader (java.io.StringReader)11 WebService (jakarta.jws.WebService)10 DataSource (jakarta.activation.DataSource)8 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)7 JAXBElement (jakarta.xml.bind.JAXBElement)7 Handler (jakarta.xml.ws.handler.Handler)7 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)6 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 ByteArrayInputStream (java.io.ByteArrayInputStream)6 JAXBContext (jakarta.xml.bind.JAXBContext)5 Binding (jakarta.xml.ws.Binding)5 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)5 SOAPBinding (jakarta.xml.ws.soap.SOAPBinding)5