Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with jax-ws trying to overide default callback endpoint address

 
Jeff Gaer
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm having problems trying to implement a callback that has a client defined endpoint. I used wsimport to build the interfaces.
I did a simple implementation of the callback method that just printlns a message. Every thing works fine if I dont try to override the
endpoint and just use the endpoint defined in the wsdl that the code was generated from.

cbService=new AudioStreamCallbackServices();
cbPort=cbService.getAudioStreamCallbackServicesPort();

However if I try to pass in a url the constructor for the service throws an exception


SEVERE: {http://interfaces.ticomgeo.com/2010/geonet/AudioStream/v0}AudioStreamCallbackServices is not a valid service.
Valid services are: {http://interfaces.ticomgeo.com/2010/geonet/AudioStream/v0}AudioStreamCallbackPortImplService
javax.xml.ws.WebServiceException: {http://interfaces.ticomgeo.com/2010/geonet/AudioStream/v0}AudioStreamCallbackServices
is not a valid service. Valid services are: {http://interfaces.ticomgeo.com/2010/geonet/AudioStream/v0}AudioStreamCallbackPortImplService
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:233)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:106)

The url in the wsdl is

<soap:address location="http://localhost:8055/AudioStreamCallback/"/>

I have tried building urls from

http://localhost:8055/AudioStreamCallback/
http://localhost:8055/AudioStreamCallback
http://localhost:8055/AudioStreamCallback?wsdl

I get the same result when I used the contructor that accepts a url , In each case I can see the schemas streaming back to the service that
is calling the callback (using tcpmon).

The annotations in the generated Service proxy are
private final static QName AUDIOSTREAMCALLBACKSERVICES_QNAME =
new QName("http://interfaces.ticomgeo.com/2010/geonet/AudioStream/v0", "AudioStreamCallbackServices");

I grepped my entire source tree for AudioStreamCallbackPortImplService and it doesnt occur, but I do see the sample name as the
service name when I use the Oxygen WSDL soap analyzer so it must be generated by jax-ws based on the schema contents.

find . -exec grep AudioStreamCallbackPortImplService {} \;

Simple question is what is the easiest way for me to dynamically set the service endpoint address at run time.
 
Jeff Gaer
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer my own question

Service service = new Service();
port = service.getPort();
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic