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>
.............