0

I am writing a client to an existing SOAP web service. I have generated the stubs using the wsimport utility against the WSDL file of an instance of the service running in my Tomcat.

The problem is, wsimport uses fixed URL addresses inside the generated code and therefore the application only works when running against one particular server (e.g. in my testing environment).

I would need to be able to parametrize the stubs with an URL address of the actual deployment of the service.


According to this thread, it should help to use the two-argument constructor instead of the default one and pass the actual URL address of the WSDL file and the same qualified name as used in the default constructor.

This does not work for me though. It throws the following exception:

Exception in thread "main" java.lang.Error: Undefined operation name GetMetadataLanguages
    at com.sun.xml.ws.model.JavaMethodImpl.freeze(JavaMethodImpl.java:327)
    at com.sun.xml.ws.model.AbstractSEIModelImpl.freeze(AbstractSEIModelImpl.java:97)
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:268)
    at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:633)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:328)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:311)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:304)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at com.opentext.livelink.service.docman.DocumentManagement_Service.getBasicHttpBindingDocumentManagement(DocumentManagement_Service.java:66)
    at cz.csinsertdt.util.cs.CSAuthenticationHandler.getDocManagementService(CSAuthenticationHandler.java:91)
    at cz.csinsertdt.TestScenario02.getDocManagementService(TestScenario02.java:264)
    at cz.csinsertdt.TestScenario02.run(TestScenario02.java:73)
    at cz.csinsertdt.TestScenario02.main(TestScenario02.java:57)

What am I doing wrong?


The part of my code which throws the exception looks like this:

DocumentManagement_Service service = new DocumentManagement_Service(
    new URL(location.toString() + "/DocumentManagement?wsdl"),
    new QName("urn:DocMan.service.livelink.opentext.com", "DocumentManagement")
);

DocumentManagement endpoint = service.getBasicHttpBindingDocumentManagement();
setSoapHeader((WSBindingProvider) endpoint, otAuth);

return endpoint;

otAuth is an autorization token obtained from another service.

Community
  • 1
  • 1
Dušan Rychnovský
  • 11,699
  • 8
  • 41
  • 65

0 Answers0