Пример #1
0
  public void testCreateDispatchJAXBMSEPRNoPortQName() 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();

    MemberSubmissionEndpointReference msEPR = createMSEPRStubServiceWithWSDL(service);
    msEPR.portTypeName.name = null;

    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 testCreateDispatchSourceMSEPRNoPortQName() 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();

    MemberSubmissionEndpointReference msEPR = createMSEPRStubServiceWithWSDL(service);
    // MemberSubmissionEndpointReference.AttributedQName portTypeName = msEPR.portTypeName;
    // QName portQName = portTypeName.name;
    msEPR.portTypeName.name = null;
    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 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);
  }
Пример #4
0
  // UsingAddressing wsdl:required=true
  public void testCreateDispatchSource() 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();
    Dispatch<Source> dispatch =
        service.createDispatch(PORT_QNAME, 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);
  }
Пример #5
0
  public void testCreateDispatchJAXB() 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();
    Dispatch<Object> dispatch =
        service.createDispatch(PORT_QNAME, 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);
  }