예제 #1
0
  public void testCreateDispatchJAXBMSEPR() throws Exception {

    if (ClientServerTestUtil.useLocal()) {
      System.out.println("HTTP Transport Only Exiting");
      return;
    }

    RespectBindingFeature rbf = new RespectBindingFeature(true);
    WebServiceFeature[] wse = new WebServiceFeature[] {rbf};
    Service service = createServiceWithWSDL();

    EndpointReference msEPR = createMSEPRStubServiceWithWSDL(service);
    MSEPRString = msEPR.toString();
    Dispatch<Object> dispatch =
        service.createDispatch(
            EndpointReference.readFrom(makeStreamSource(MSEPRString)),
            createJAXBContext(),
            Service.Mode.PAYLOAD,
            wse);
    AddNumbers addNumbers = factory.createAddNumbers();
    addNumbers.setNumber1(2);
    addNumbers.setNumber2(4);
    JAXBElement<AddNumbers> num = factory.createAddNumbers(addNumbers);
    JAXBElement<AddNumbersResponse> addNumbersResponse =
        (JAXBElement<AddNumbersResponse>) dispatch.invoke(num);
    AddNumbersResponse response = addNumbersResponse.getValue();
    assertEquals(response.getReturn(), 2 + 4);
  }
예제 #2
0
  // UsingAddressing wsdl:required=true
  public void testCreateDispatchSourceMSEPR() throws Exception {

    if (ClientServerTestUtil.useLocal()) {
      System.out.println("HTTP Transport Only Exiting");
      return;
    }

    RespectBindingFeature rbf = new RespectBindingFeature(true);
    WebServiceFeature[] wse = new WebServiceFeature[] {rbf};
    Service service = createServiceWithWSDL();

    EndpointReference msEPR = createMSEPRStubServiceWithWSDL(service);
    MSEPRString = msEPR.toString();
    Dispatch<Source> dispatch =
        service.createDispatch(
            EndpointReference.readFrom(makeStreamSource(MSEPRString)),
            Source.class,
            Service.Mode.PAYLOAD,
            wse);
    Source result = dispatch.invoke(makeStreamSource(MSGSrc));
    JAXBElement<AddNumbersResponse> addNumberResponse =
        (JAXBElement<AddNumbersResponse>)
            createJAXBContext().createUnmarshaller().unmarshal(result);
    AddNumbersResponse response = addNumberResponse.getValue();
    assertEquals(response.getReturn(), 2 + 4);
  }
예제 #3
0
  public void testCreateDispatchSMWsdlMSEPR() throws Exception {

    if (ClientServerTestUtil.useLocal()) {
      System.out.println("HTTP Transport Only Exiting");
      return;
    }

    RespectBindingFeature rbf = new RespectBindingFeature(false);
    WebServiceFeature[] wse = new WebServiceFeature[] {rbf};
    Service service = createServiceWithWSDL();
    EndpointReference msEPR = createMSEPRStubServiceWithWSDL(service);

    MSEPRString = msEPR.toString();

    Dispatch<SOAPMessage> dispatch =
        service.createDispatch(
            EndpointReference.readFrom(makeStreamSource(MSEPRString)),
            SOAPMessage.class,
            Service.Mode.MESSAGE,
            wse);
    SOAPMessage sm = dispatch.invoke(getSOAPMessage(makeStreamSource(SMMsg)));
    sm.writeTo(System.out);

    // System.out.println("Adding numbers 2 and 4");
    // int result = dispatch.invoke(getSOAPMessage())
    // assert(result == 6);
    // System.out.println("Addinion of 2 and 4 successful");
  }
예제 #4
0
  public void testCreateDispatchJAXBWEPR() throws Exception {
    String eprString =
        "<EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\"><Address>"
            + "http://localhost:8080/jaxrpc-client_jaxws21_service_dispatch_features/hello</Address>"
            + "<Metadata><wsaw:ServiceName xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\" xmlns:wsns=\"http://example.com/\" EndpointName=\"AddNumbersPort\">wsns:AddNumbersService</wsaw:ServiceName>"
            + "</Metadata></EndpointReference>";
    if (ClientServerTestUtil.useLocal()) {
      System.out.println("HTTP Transport Only Exiting");
      return;
    }

    RespectBindingFeature rbf = new RespectBindingFeature(true);
    WebServiceFeature[] wse = new WebServiceFeature[] {rbf};

    Service service = createServiceWithWSDL();

    EndpointReference w3cEPR = createEPRStubServiceWithWSDL(service);
    // W3CEPRString = w3cEPR.toString();
    W3CEPRString = eprString;
    Dispatch<Object> dispatch =
        service.createDispatch(
            EndpointReference.readFrom(makeStreamSource(W3CEPRString)),
            createJAXBContext(),
            Service.Mode.PAYLOAD,
            wse);
    AddNumbers addNumbers = factory.createAddNumbers();
    addNumbers.setNumber1(2);
    addNumbers.setNumber2(4);
    JAXBElement<AddNumbers> num = factory.createAddNumbers(addNumbers);
    JAXBElement<AddNumbersResponse> addNumbersResponse =
        (JAXBElement<AddNumbersResponse>) dispatch.invoke(num);
    AddNumbersResponse response = addNumbersResponse.getValue();
    assertEquals(response.getReturn(), 2 + 4);
  }
예제 #5
0
  public void testCreateDispatchSMWsdlWEPR() throws Exception {
    String eprString =
        "<EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\"><Address>"
            + "http://localhost:8080/jaxrpc-client_jaxws21_service_dispatch_features/hello</Address>"
            + "<Metadata><wsaw:ServiceName xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\" xmlns:wsns=\"http://example.com/\" EndpointName=\"AddNumbersPort\">wsns:AddNumbersService</wsaw:ServiceName>"
            + "</Metadata></EndpointReference>";
    if (ClientServerTestUtil.useLocal()) {
      System.out.println("HTTP Transport Only Exiting");
      return;
    }

    RespectBindingFeature rbf = new RespectBindingFeature(false);
    WebServiceFeature[] wse = new WebServiceFeature[] {rbf};
    Service service = createServiceWithWSDL();
    EndpointReference w3cEPR = createEPRStubServiceWithWSDL(service);
    // W3CEPRString = w3cEPR.toString();
    W3CEPRString = eprString;
    Dispatch<SOAPMessage> dispatch =
        service.createDispatch(
            EndpointReference.readFrom(makeStreamSource(W3CEPRString)),
            SOAPMessage.class,
            Service.Mode.MESSAGE);
    SOAPMessage sm = dispatch.invoke(getSOAPMessage(makeStreamSource(SMMsg)));
    sm.writeTo(System.out);
    // System.out.println("Adding numbers 2 and 4");
    // int result = dispatch.invoke(getSOAPMessage())
    // assert(result == 6);
    // System.out.println("Addinion of 2 and 4 successful");
  }