ws-wsif-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmal Mukhi <nmu...@us.ibm.com>
Subject Re: Service Name's soap:address location
Date Mon, 10 Nov 2003 23:00:12 GMT
Hi,

This is a bit unusual. Maube you should check the version of wsdl4j.jar 
you have, and upgrade to the latest version (available from 
http://www-124.ibm.com/developerworks/projects/wsdl4j/). Or you can just 
check the WSDL4J source for the JAR that you have (you can just get a 
snapshot of the tree from the date your JAR was created using CVS) and 
check what the appropriate method name is. Maybe I got the nethod name 
wrong, so don't take my word for the syntax of the code.

Nirmal.




"Leo Barcenas" <leo@sd-net.co.jp>
11/07/2003 01:05 AM
Please respond to wsif-user
 
        To:     <wsif-user@ws.apache.org>
        cc: 
        Subject:        Re: Service  Name's soap:address location


 
Hi Nirmal,
 
It's me again.
Again thanks for this information.
I tried the code you suggested to me below. But,
I guess my the library that I'm using is old. I was able 
to get right until:
 
Service service = def.getService(new QName("foo","bar"); // accesses 
service named foo:bar 
But, the "service" does not have the getExtensibilityElements method 
that you wrote. I'm using the WSIF 2.0 API version. Are there any upper 
version that I shoud install. Or any Jar files that I should dowload?
 
Again many thanks.
 
 
Leo
 
 
 
 
----- Original Message ----- 
From: Nirmal Mukhi 
To: wsif-user@ws.apache.org 
Sent: Thursday, November 06, 2003 2:18 AM
Subject: Re: Service Name's soap:address location


Hi, 

You can modify the service endpoint in the WSDL definition 
programmatically. Here is some sample code which should do this (not 
compiled or tested, but it should be approximately correct). This uses the 
standard WSDL API being defined in JSR110 (see 
http://oss.software.ibm.com/developerworks/projects/wsdl4j for the 
reference implementation). 

WSDLFactory factory = WSDLFactory.newInstance(); 
WSDLReader reader = factory.newWSDLReader(); 
Definition def = reader.readWSDL(null,"sample.wsdl"); 
Service service = def.getService(new QName("foo","bar"); // accesses 
service named foo:bar 
List extElements = service.getExtensibilityElements(); 
SOAPAddress address = (SOAPAddress) extElements.get(0); // this assumes 
that there is only one extensibility element under <service>, viz. 
soap:address 
address.setLocationURL("http://newURI"); 

Now the definition (def) can be used by WSIF to create a WSIFService that 
will attempt to invoke the service whose SOAP endpoint is http://newURI. 

Hope that helps, 
Nirmal. 



"David Seager" <SEAGER@uk.ibm.com> 
10/30/2003 08:13 AM 
Please respond to wsif-user 
        
        To:        wsif-user@ws.apache.org 
        cc:         
        Subject:        Re: Service  Name's soap:address location




Hi Leo,

That WSDL shouldn't execute correctly from a remote client, as localhost
will resolve to the machine it's being run on. The best way is to store 
the
WSDL on a web server on the remote server machine, with the location set
with the remote server's hostname. Then point the client at the WSDL on 
the
remote server.

However, if you know which provider gets used, there are methods on some 
to
override the location URL. In the WSIFPort_ApacheAxis class, in the Apache
Axis provider, there is a setEndPoint method which will do the trick. Here
is my code which changes the URL to something else:

     String wsdlLocation = "http://localhost:8080/axis/Expire.jws?wsdl";
     WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
     WSIFService service = factory.getService(wsdlLocation, null, null,
null, null);
     WSIFPort p = service.getPort();

     // override port
     WSIFPort_ApacheAxis pA = (WSIFPort_ApacheAxis)p;
     pA.setEndPoint(new URL("http://localhost:8081/axis/Expire.jws"));

     o = p.createOperation(operation);

     m1 = o.createInputMessage();
     m2 = o.createOutputMessage();
     m3 = o.createFaultMessage();

     boolean ok = o.executeRequestResponseOperation(m1, m2, m3);

The WSDL referenced defines the Expire service to be at
http://localhost:8080/axis/Expire.jws. However, the above code sends the
request to the address in the override call. This only works if the
provider being used is Apache Axis.

Regards,


David Seager
IBM Hursley
Internet seager@uk.ibm.com


  
                     "Leo Barcenas"   
                     <leo@sd-net.co.jp        To: 
<wsif-user@ws.apache.org> 
                     >                        cc:    
                                              Subject:  Service  Name's 
soap:address location 
                     30/10/2003 11:33   
                     Please respond to   
                     wsif-user   
  
  





Hello!

I would like to ask about the WSDL file used in WSIF. In particular,
the soap:address location of the Service name.
I'm just quiet puzzled that some of the files I saw is written the one
below,

 <service name="ServiceNM">
   <port name="SoapPort" binding="tns:SoapBinding">
     <soap:address location="http://localhost/WSDL/iLON100.WSDL" />
   </port>
 </service>

Considering the above WSDL syntax, will this be able to correctly execute
from a remote client? If not, is there a way that you can change
"localhost"
into the IP address of the server where the web service is located during
runtime? I've tried it in VB.NET by using the WebReference's URL property
and replacing "localhost" to the server's IP address.

Hoping for your answer.


Many thanks.


Leo







Mime
View raw message