Re: Service Name's soap:address location
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" <[EMAIL PROTECTED]> 11/07/2003 01:05 AM Please respond to wsif-user To: <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] 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 , 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" <[EMAIL PROTECTED]> 10/30/2003 08:13 AM Please respond to wsif-user To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] "Leo Barcenas" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> > cc: Subject: Service Name's soap:address
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: [EMAIL PROTECTED] 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 , 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" <[EMAIL PROTECTED]> 10/30/2003 08:13 AM Please respond to wsif-user To: [EMAIL PROTECTED] cc: Subject: Re: Service Name's soap:address locationHi Leo,That WSDL shouldn't execute correctly from a remote client, as localhostwill resolve to the machine it's being run on. The best way is to store theWSDL on a web server on the remote server machine, with the location setwith the remote server's hostname. Then point the client at the WSDL on theremote server.However, if you know which provider gets used, there are methods on some tooverride the location URL. In the WSIFPort_ApacheAxis class, in the ApacheAxis provider, there is a setEndPoint method which will do the trick. Hereis 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 athttp://localhost:8080/axis/Expire.jws. However, the above code sends therequest to the address in the override call. This only works if theprovider being used is Apache Axis.Regards,David SeagerIBM HursleyInternet [EMAIL PROTECTED] "Leo Barcenas" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> > cc: Subject: Service Name's soap:address location 30/10/2003 11:33
Re: Service Name's soap:address location
Hi Nirmal, Thanks for the information. I manually changed the WSDL soap:address at the moment but, I'll use this to programmatically change it. This is very useful. I'll try this later. Again thanks. Leo - Original Message - From: Nirmal Mukhi To: [EMAIL PROTECTED] 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 , 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" <[EMAIL PROTECTED]> 10/30/2003 08:13 AM Please respond to wsif-user To: [EMAIL PROTECTED] cc: Subject: Re: Service Name's soap:address locationHi Leo,That WSDL shouldn't execute correctly from a remote client, as localhostwill resolve to the machine it's being run on. The best way is to store theWSDL on a web server on the remote server machine, with the location setwith the remote server's hostname. Then point the client at the WSDL on theremote server.However, if you know which provider gets used, there are methods on some tooverride the location URL. In the WSIFPort_ApacheAxis class, in the ApacheAxis provider, there is a setEndPoint method which will do the trick. Hereis 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 athttp://localhost:8080/axis/Expire.jws. However, the above code sends therequest to the address in the override call. This only works if theprovider being used is Apache Axis.Regards,David SeagerIBM HursleyInternet [EMAIL PROTECTED] "Leo Barcenas" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> > 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
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 , 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" <[EMAIL PROTECTED]> 10/30/2003 08:13 AM Please respond to wsif-user To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] "Leo Barcenas" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> > 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, 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
Re: Service Name's soap:address location
Hello David, Thanks for the information. I forgot to tell write that I received an exception when I call the getPort method of the service. WSIFPort p = service.getPort(); The exact exception is: org.apache.wsif.WSIFException: Unable to find an available port at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source) at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source) Is there any way, that I could change the soap:address before I call the getPort method? I tried using another way, using the definition file for the service. Below is a snippet of the code: Definition defWSDL = WSIFUtils.readWSDL(null, args[0]); WSIFService service = new WSIFService.class(); service = factory.getService( defWSDL, defWSDL.getService(defWSDL.getQName()), defWSDL.getPortType(defWSDL.getQName())); Same exception happens with this code. There is probably another way perhaps to change the definition file. Right after the readWSDL method. I tried to copy the WSDL file locally, and change the soap:address to the remote server IP address. But, same thing happens. Is there anyway, that I can change the soap:address of Definition file? Hoping for your answer. Many thanks. Leo - Original Message - From: "David Seager" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 30, 2003 10:13 PM 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 [EMAIL PROTECTED] > > > > "Leo Barcenas" > <[EMAIL PROTECTED]To: <[EMAIL PROTECTED]> > >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, > > > > http://localhost/WSDL/iLON100.WSDL"; /> > > > > 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 > > > > > >
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 [EMAIL PROTECTED] "Leo Barcenas" <[EMAIL PROTECTED]To: <[EMAIL PROTECTED]> >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, http://localhost/WSDL/iLON100.WSDL"; /> 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