• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Will this plan work? What did I do wrong? Thanks.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I'm totally new to web services and I'm stuck with a urgent development task and hope to get help.

This is a piece of code that will be running on the application server side, there will be hundreds of devices each has its own IP address, but runs exactly the same web services, and my code will need to talk to each of the selected ones using its IP address. I see that in some cases the generated proxy class contain the particular IP of the device where the web service is running on. If this is the case all the time, then it won't be possible for me to use a client proxy class to talk to all the devices?

I'm currently trying something like this that will allow the code to use an IP 'dynamically':

URL url = new URL("http://172.21.159.52:80/cmi?wsdl");
QName serviceName = new QName("urn:Genus", "genusService");
Service service = Service.create(url, serviceName);
//These are for testing purpose
System.out.println ("List of QNames of service endpoints:");
Iterator it = service.getPorts();
while (it.hasNext ()) {
System.out.println (" " + it.next());


I can see the single service named 'genusPortType' in the output, however when the following code is reached:

QName portName = new QName("urn:Genus", "genusPortType");
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class,Service.Mode.MESSAGE);

I got an error 'javax.xml.ws.WebServiceException: Illegal argument combination [type=javax.xml.soap.SOAPMessage,mode=MESSAGE]'. I'm confused because I see the same usage in lots of sample codes. Is it because the 'portName' part decides that these two parameters are not fit based upon the definition of 'genusPortType'? If the operation is defined like this in the wsdl file, wht values should I use?

(I have to put an extra space between ':' and 'o' to make it not shown as a '')

<wsdl:binding name="genusBinding" type="cmi:genusPortType">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<!-- login operation -->
<wsdl: operation name="login" >
<wsdlsoap: operation soapAction="com.controlmod.terminal.services.web.services.Login#Login" />
<wsdl:input name="loginRequest" >
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</wsdl:input>
<wsdl: output name="loginResponse" >
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</wsdl: output>
</wsdl: operation>
.............
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I suspect the best way is for the clients to include their IP as a parameter when sending requests to the web service.
In the web service, you will never be able to retrieve anything more than the IP of the last proxy the request passed through (this information can be obtained in a web service handler, from the servlet request object retrieved from the SOAP message context by using the key MessageContext.SERVLET_REQUEST).
This is not a problem if you can ensure that clients never go through any intermediaries when connecting to your web service, but if there are intermediaries, such as proxies, then there will be problems.
Best wishes!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic