Ejemplo n.º 1
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);
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 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");
  }