Hi,

If you use JAXWS API , you can using the add port to add the other port for your client to access.
URL wsdlURL = MyService.class.getClassLoader.getResource("service2.wsdl");
 QName serviceName = new QName("urn:service2", "MyService");
 QName portName = new QName("urn:service2", "ServicePort");
 MyService service = new MyService(wsdlURL, serviceName);
service.addPort(portName, "http://schemas.xmlsoap.org/soap/";, "https://localhost/sdk/myService";); // pass the SEI class that is generated by wsdl2java ServicePort proxy = service.getPort(portName, SEI.class);

If you use CXF API , you could set the endpoint address directly to the ClientProxyFactoryBean.

BTW, if you want to access the service by using https protocol, you need to do some configuration on the client side.

You can find more information from this url [1]
[1]http://www.nabble.com/Generated-client-to-connect-to-a-https-ws-tf4061903.html

Willem.


Joe Sunday wrote:
Sorry if this one is easy, but I can't seem to find it...

I've got an interface I generated from a local wsdl, and the wsdl files are both available on my classpath:
<definitions targetNamespace="urn:myService"
   xmlns="http://schemas.xmlsoap.org/wsdl/";
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
   xmlns:interface="urn:service2">
   <import location="service2.wsdl" namespace="urn:service2" />
   <service name="MyService">
      <port binding="interface:ServiceBinding" name="ServicePort">
         <soap:address location="https://localhost/sdk/myService"; />

How do I create a client for this wsdl against a random url? The binding classes seem to only accept the urn and address specified in the wsdl, which doesn't work if the url I actually want to talk to isn't localhost/sdk/myService

URL wsdlURL = MyService.class.getClassLoader.getResource("myService.wsdl");
  QName serviceName = new QName("urn:myService", "MyService");
  MyService service = new MyService(wsdlURL, serviceName);
  ServicePort client = service.getServicePort();

I don't see a generated ServiceLocator in the classes wsdl2java generated anywhere.

--Joe


Reply via email to