Skip to main content

How to dynamicaly invoke a Provider WebService without a WSDL

1 reply [Last post]
wierob
Offline
Joined: 2007-03-26
Points: 0

Hi,

I have a provider based WebService that is not specified via a WSDL. Now I need a way to call this from Java 6. In .NET I only need to create an EndpointReference an all works fine.

I created a W3CEndpointReference in Java 6 that points to the URL of the WebService. If I try to create a Dispatch as follows:

// usally I insert the wsdlLocation here, but what if I don't have one ???
Service service = Servcie.create(new QName("",""));

EndpointReference epr = W3CEndpointReference(new StreamSource(new StringReader()));

dispatch = service.createDispatch(epr, SOAPMessage.class, new WebServiceFeature[0]);

I get an error "WSDL metadata required for current operation"

thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wierob
Offline
Joined: 2007-03-26
Points: 0

The following does the trick:

Service service = Service.create(SERVICE_QNAME);
service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING,
"http://localhost:8080/");

Dispatch dispatch = service.createDispatch(PORT_QNAME,
SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE);

dispatch.invoke(makeSOAPMessage(helloRequest));

for more information see: https://jax-ws.dev.java.net/nonav/2.1.1rc1/docs/dispatch.html