You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by slocum <sl...@weirdrealm.com> on 2011/03/17 18:03:43 UTC

Soap ws binding with addPort()

(new issue related to yesterday's question.)

I'm using addPort() to access a web service from a JSP. It works, I can get
the data I want. Yay!

My problem is that I had to hardcode the port number of the web service to
get things to work. I have three sets of servers to manage: development,
test, and production. These servers use different ports for this web
service.

Here's my current JSP code:

<%  
	CMPSWebService service = new CMPSWebService();
	QName portName = new QName("http://ws.cmps.digitalriver.com",
"CMPSWebServiceHttpPort");
	service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
"http://localhost:5309/cmps-1.0/services/CMPSWebService/");
	CMPSWebServicePortType port = service.getCMPSWebServiceHttpPort();
	LookupProductResponseType resp = port.lookupProduct();
...
%>

I avoided the hostname problem by using localhost, but that pesky port 5309
is in there. 

How can I generically do this so I don't hardcode the port number?

Thanks,
Brett

--
View this message in context: http://cxf.547215.n5.nabble.com/Soap-ws-binding-with-addPort-tp3888711p3888711.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Soap ws binding with addPort()

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I'm not an expertise about JSP, I'm wondering if JSP support system  
property passed in just like java code, if it support, you can use  
system property for your port, so that you can specify for different  
scenario.

Or if you use mvn to build your project, you can use filter plugin  
from which you can specify different system property for different  
scenario(development, test, production), but you still need rebuild in  
this case.

Freeman
On 2011-3-18, at 上午1:03, slocum wrote:

> (new issue related to yesterday's question.)
>
> I'm using addPort() to access a web service from a JSP. It works, I  
> can get
> the data I want. Yay!
>
> My problem is that I had to hardcode the port number of the web  
> service to
> get things to work. I have three sets of servers to manage:  
> development,
> test, and production. These servers use different ports for this web
> service.
>
> Here's my current JSP code:
>
> <%
> 	CMPSWebService service = new CMPSWebService();
> 	QName portName = new QName("http://ws.cmps.digitalriver.com",
> "CMPSWebServiceHttpPort");
> 	service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
> "http://localhost:5309/cmps-1.0/services/CMPSWebService/");
> 	CMPSWebServicePortType port = service.getCMPSWebServiceHttpPort();
> 	LookupProductResponseType resp = port.lookupProduct();
> ...
> %>
>
> I avoided the hostname problem by using localhost, but that pesky  
> port 5309
> is in there.
>
> How can I generically do this so I don't hardcode the port number?
>
> Thanks,
> Brett
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Soap-ws-binding-with-addPort-tp3888711p3888711.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org