newbie question about soap address
wutongjoe Mar 22, 2012 4:35 AMHi all,
I was developing an EJB based webservice .I have configed JBAS 7.1 to use https .I can browse wsdl and view xml using browser with following address:
https://localhost:8444/webservices/ExampleService?wsdl
but the end of wsdl always show the following lines:
<wsdl:service name="WSMashupService">
<wsdl:port name="WSMashupServicePort" binding="tns:WSMashupServiceSoapBinding">
<soap:address location="http://localhost:8080/webservices/ExampleService"/>
</wsdl:port>
</wsdl:service>
my client side code always try to connect to port 8080 after parsing wsdl .
client side code is like following :
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("testuser", "testpass"
.toCharArray());
}
});
URL wsdlURL = new URL(
"https://localhost:8444/webservices/ExampleService?wsdl");
QName qname = new QName("http://test.com/webservices",
"WSMashupService");
Service service = Service.create(wsdlURL, qname);
WSMashupInterface port = service.getPort(WSMashupInterface.class);
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"testuser");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"testpass");
port.dosomethingMashup("12121212121212"); ---------------------------------this line always throw exception :
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
the server config is :
...
<subsystem xmlns="urn:jboss:domain:web:1.1" native="false" default-virtual-server="default-host">
<connector name="http" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl key-alias="serverCert" password="servercert" certificate-key-file="${jboss.server.config.dir}/jboss.keystore"/>
</connector>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<wsdl-secure-port>8444</wsdl-secure-port>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>
the server side code is :
@Stateless
@Clustered
@WebContext( contextRoot = "/webservices" , urlPattern="/ExampleService",authMethod="BASIC", transportGuarantee="NONE", secureWSDLAccess=true)
@WebService(name="WSMashupService",serviceName = "WSMashupService", targetNamespace = "http://test.com/webservices")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@SecurityDomain(value = "my-security-domain")
@RolesAllowed(value = { "testrole" })
public class WSMashupImpl implements WSMashupInterface {
the interface code :
@WebService(name="WSMashupService",serviceName = "WSMashupService", targetNamespace = "http://test.com/webservices")
@WebContext( contextRoot = "/webservices" , urlPattern="/ExampleService",authMethod="BASIC", transportGuarantee="NONE", secureWSDLAccess=true)
public interface WSMashupInterface {
I think the problem is with soap address rewrite which I do not see any further config needed .Am I right ? what is wrong with my code and config ?
Thanks a lot