private void changeTransportUriToZmq(Endpoint ep) {
   if (ep.getBinding() == null) {
     return;
   }
   if (ep.getBinding().getBindingInfo() == null) {
     return;
   }
   BindingInfo bindingInfo = ep.getBinding().getBindingInfo();
   if (bindingInfo instanceof SoapBindingInfo) {
     SoapBindingInfo soapBindingInfo = (SoapBindingInfo) bindingInfo;
     soapBindingInfo.setTransportURI("http://schemas.xmlsoap.org/soap/zmq");
   }
 }
Ejemplo n.º 2
0
  public BindingInfo createBindingInfo(ServiceInfo service, javax.wsdl.Binding binding, String ns) {
    SoapBindingInfo bi = new SoapBindingInfo(service, ns);
    // Copy all the extensors
    initializeBindingInfo(service, binding, bi);

    SoapBinding wSoapBinding =
        SOAPBindingUtil.getSoapBinding(bi.getExtensors(ExtensibilityElement.class));

    bi.setTransportURI(wSoapBinding.getTransportURI());
    bi.setStyle(wSoapBinding.getStyle());

    for (BindingOperationInfo boi : bi.getOperations()) {
      initializeBindingOperation(bi, boi);
    }

    return bi;
  }
  @Test
  public void testDestination() throws Exception {
    String wsdlSoapNs = "http://schemas.xmlsoap.org/wsdl/soap/";
    String transportURI = "http://foo/transport";
    // String location = "http://localhost/service";

    ServiceInfo si = new ServiceInfo();
    EndpointInfo ei = new EndpointInfo(si, wsdlSoapNs);
    // this code used to call "new SOAPAddressImpl()", but the test
    // is currently not testing anything, and needlessly ties the
    // code to a specific implementation of wsdl4j. When the SOAPAddress
    // is really needed, it should be mocked.
    SOAPAddress add = null;
    // add.setLocationURI(location);
    ei.addExtensor(add);

    SoapBindingInfo bi = new SoapBindingInfo(si, "", Soap11.getInstance());
    bi.setTransportURI(transportURI);
    ei.setBinding(bi);

    IMocksControl control = EasyMock.createNiceControl();
    DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
    DestinationFactory fooDF = control.createMock(DestinationFactory.class);
    Destination dest = control.createMock(Destination.class);

    EasyMock.expect(dfm.getDestinationFactory(transportURI)).andReturn(fooDF);
    EasyMock.expect(fooDF.getDestination(ei, null)).andStubReturn(dest);

    control.replay();

    // SoapDestinationFactory sdf = new SoapDestinationFactory(dfm);
    // Destination dest2 = sdf.getDestination(ei);
    // assertNotNull(dest2);

    // TODO: doesn't pass because I don't know how to use easymock :-(
    // assertEquals(dest, dest2);
  }
Ejemplo n.º 4
0
  public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) {
    SoapBindingConfiguration config;
    if (conf instanceof SoapBindingConfiguration) {
      config = (SoapBindingConfiguration) conf;
    } else {
      config = new SoapBindingConfiguration();
    }
    if (WSDLConstants.NS_SOAP12.equals(bindingid)
        || WSDLConstants.NS_SOAP12_HTTP_BINDING.equals(bindingid)) {
      config.setVersion(Soap12.getInstance());
      config.setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    SoapBindingInfo info = new SoapBindingInfo(si, bindingid, config.getVersion());

    info.setName(config.getBindingName(si));
    info.setStyle(config.getStyle());

    info.setTransportURI(config.getTransportURI());

    if (config.isMtomEnabled()) {
      info.setProperty(Message.MTOM_ENABLED, Boolean.TRUE);
    }

    for (OperationInfo op : si.getInterface().getOperations()) {
      SoapOperationInfo sop = new SoapOperationInfo();
      sop.setAction(config.getSoapAction(op));
      sop.setStyle(config.getStyle(op));

      BindingOperationInfo bop =
          info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());

      bop.addExtensor(sop);

      info.addOperation(bop);

      BindingMessageInfo bInput = bop.getInput();
      if (bInput != null) {
        MessageInfo input = null;
        BindingMessageInfo unwrappedMsg = bInput;
        if (bop.isUnwrappedCapable()) {
          input = bop.getOperationInfo().getUnwrappedOperation().getInput();
          unwrappedMsg = bop.getUnwrappedOperation().getInput();
        } else {
          input = bop.getOperationInfo().getInput();
        }
        setupHeaders(bop, bInput, unwrappedMsg, input, config);
      }

      BindingMessageInfo bOutput = bop.getOutput();
      if (bOutput != null) {
        MessageInfo output = null;
        BindingMessageInfo unwrappedMsg = bOutput;
        if (bop.isUnwrappedCapable()) {
          output = bop.getOperationInfo().getUnwrappedOperation().getOutput();
          unwrappedMsg = bop.getUnwrappedOperation().getOutput();
        } else {
          output = bop.getOperationInfo().getOutput();
        }
        setupHeaders(bop, bOutput, unwrappedMsg, output, config);
      }
    }

    try {
      createSoapBinding(info);
    } catch (WSDLException e) {
      e.printStackTrace();
    }

    return info;
  }