[jboss-user] [JBossWS] - Consuming .net Web Service using JBOSSWS

vimalm do-not-reply at jboss.com
Wed Sep 20 15:26:45 EDT 2006


Hi

I am trying to consume a .net webservice (document/literal) inside one of my EJB's or a stand alone client starting from a WSDL URL in the form http://someurl/someservice.asmx

The steps I took is to create the supporting classes using WSTOOLS with following configuration and then invoking the web service.


<configuration xmlns="http://www.jboss.org/jbossws-tools">
  | 	<wsdl-java file="someservice.wsdl">
  | 		<mapping file="jaxrpc-mapping.xml" />
  | 	</wsdl-java>
  | </configuration>

I downloaded someservice.wsdl from above url?WSDL link. I read that that the URL could be refered in a jboss-client.xml file but I will do that later.

Now in my client I am trying to call  the web service using:

package somewebsite;
  | 
  | import java.net.URL;
  | import java.io.File;
  | import org.jboss.ws.jaxrpc.ServiceFactoryImpl;
  | import javax.xml.namespace.QName;
  | import javax.xml.rpc.Service;
  | import javax.xml.rpc.Stub;
  | 
  | public class Test {
  | 	public static void main(String[] args) {
  | 		Test test = new Test();
  | 		test.call();
  | 	}
  | 	
  | 	public void call() {
  | 	      try {
  | 		URL wsdlURL = new URL("http://someurl/someservice.asmx?WSDL");		
  | 		ServiceFactoryImpl servFactory = new ServiceFactoryImpl();
  | 		URL mappingURL = new File("jaxrpc-mapping.xml").toURL();
  | 		QName qname = new QName("http://somewebsite.net", "UserManagement");
  | 		Service service = servFactory.createService(wsdlURL, qname, mappingURL);
  | 		UserManagementSoap port = (UserManagementSoap)service.getPort(UserManagementSoap.class);		GetUserList gul = new GetUserList("notfound");
  | 		GetUserListResponse gulr = port.getUserList(gul);
  | 		System.out.println("finished" + gulr.getGetUserListResult());
  | 		} catch (Exception ex) {
  | 			ex.printStackTrace();
  | 		}
  | 	}
  | 	
  | }
  | 

I get a connection time out and don't know what is wrong? I know the web service is up and running at the url because I can hit it with a .net client. I am having problem with the java client. I am using JBOSS 4.0.4GA JBOSS WS 1.0.3GA.

Here is the WSDL :

<?xml version="1.0" encoding="utf-8"?>
  | <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  | 		      xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
  | 		      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
  | 		      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
  | 		      xmlns:tns="http://somewebsite.net/" 
  | 		      xmlns:s="http://www.w3.org/2001/XMLSchema" 
  | 		      xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
  | 		      xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
  | 		      targetNamespace="http://somewebsite.net/" 
  | 		      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  |   <wsdl:types>
  |     <s:schema elementFormDefault="qualified" targetNamespace="http://somewebsite.net/">
  |       <s:element name="UpdateUser">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="creatorId" type="s:string" />
  |             <s:element minOccurs="0" maxOccurs="1" name="input" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |       <s:element name="UpdateUserResponse">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="UpdateUserResult" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |       <s:element name="DeleteUser">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="creatorId" type="s:string" />
  |             <s:element minOccurs="0" maxOccurs="1" name="input" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |       <s:element name="DeleteUserResponse">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="DeleteUserResult" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |       <s:element name="GetUserList">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="creatorId" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |       <s:element name="GetUserListResponse">
  |         <s:complexType>
  |           <s:sequence>
  |             <s:element minOccurs="0" maxOccurs="1" name="GetUserListResult" type="s:string" />
  |           </s:sequence>
  |         </s:complexType>
  |       </s:element>
  |     </s:schema>
  |   </wsdl:types>
  |   <wsdl:message name="UpdateUserSoapIn">
  |     <wsdl:part name="parameters" element="tns:UpdateUser" />
  |   </wsdl:message>
  |   <wsdl:message name="UpdateUserSoapOut">
  |     <wsdl:part name="parameters" element="tns:UpdateUserResponse" />
  |   </wsdl:message>
  |   <wsdl:message name="DeleteUserSoapIn">
  |     <wsdl:part name="parameters" element="tns:DeleteUser" />
  |   </wsdl:message>
  |   <wsdl:message name="DeleteUserSoapOut">
  |     <wsdl:part name="parameters" element="tns:DeleteUserResponse" />
  |   </wsdl:message>
  |   <wsdl:message name="GetUserListSoapIn">
  |     <wsdl:part name="parameters" element="tns:GetUserList" />
  |   </wsdl:message>
  |   <wsdl:message name="GetUserListSoapOut">
  |     <wsdl:part name="parameters" element="tns:GetUserListResponse" />
  |   </wsdl:message>
  |   <wsdl:portType name="UserManagementSoap">
  |     <wsdl:operation name="UpdateUser">
  |       <wsdl:input message="tns:UpdateUserSoapIn" />
  |       <wsdl:output message="tns:UpdateUserSoapOut" />
  |     </wsdl:operation>
  |     <wsdl:operation name="DeleteUser">
  |       <wsdl:input message="tns:DeleteUserSoapIn" />
  |       <wsdl:output message="tns:DeleteUserSoapOut" />
  |     </wsdl:operation>
  |     <wsdl:operation name="GetUserList">
  |       <wsdl:input message="tns:GetUserListSoapIn" />
  |       <wsdl:output message="tns:GetUserListSoapOut" />
  |     </wsdl:operation>
  |   </wsdl:portType>
  |   <wsdl:binding name="UserManagementSoap" type="tns:UserManagementSoap">
  |     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
  |     <wsdl:operation name="UpdateUser">
  |       <soap:operation soapAction="http://somewebsite.net/UpdateUser" style="document" />
  |       <wsdl:input>
  |         <soap:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |     <wsdl:operation name="DeleteUser">
  |       <soap:operation soapAction="http://somewebsite.net/DeleteUser" style="document" />
  |       <wsdl:input>
  |         <soap:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |     <wsdl:operation name="GetUserList">
  |       <soap:operation soapAction="http://somewebsite.net/GetUserList" style="document" />
  |       <wsdl:input>
  |         <soap:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |   </wsdl:binding>
  |   <wsdl:binding name="UserManagementSoap12" type="tns:UserManagementSoap">
  |     <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
  |     <wsdl:operation name="UpdateUser">
  |       <soap12:operation soapAction="http://somewebsite.net/UpdateUser" style="document" />
  |       <wsdl:input>
  |         <soap12:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap12:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |     <wsdl:operation name="DeleteUser">
  |       <soap12:operation soapAction="http://somewebsite.net/DeleteUser" style="document" />
  |       <wsdl:input>
  |         <soap12:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap12:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |     <wsdl:operation name="GetUserList">
  |       <soap12:operation soapAction="http://somewebsite.net/GetUserList" style="document" />
  |       <wsdl:input>
  |         <soap12:body use="literal" />
  |       </wsdl:input>
  |       <wsdl:output>
  |         <soap12:body use="literal" />
  |       </wsdl:output>
  |     </wsdl:operation>
  |   </wsdl:binding>
  |   <wsdl:service name="UserManagement">
  |     <wsdl:port name="UserManagementSoap" binding="tns:UserManagementSoap">
  |       <soap:address location="http://someurl/someservice.asmx" />
  |     </wsdl:port>
  |     <wsdl:port name="UserManagementSoap12" binding="tns:UserManagementSoap12">
  |       <soap12:address location="http://someurl/someservice.asmx" />
  |     </wsdl:port>
  |   </wsdl:service>
  | </wsdl:definitions>

Here is the stack trace I am getting:


  | org.jboss.ws.metadata.wsdl.WSDLException: java.net.ConnectException: Connection
  | timed out: connect
  |         at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.getDocument(WSDLDef
  | initionsFactory.java:198)
  |         at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitio
  | nsFactory.java:106)
  |         at org.jboss.ws.metadata.ServiceMetaData.getWsdlDefinitions(ServiceMetaD
  | ata.java:273)
  |         at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR
  | 109ClientMetaDataBuilder.java:110)
  |         at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR
  | 109ClientMetaDataBuilder.java:82)
  |         at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
  |         at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryIm
  | pl.java:157)
  |         at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryIm
  | pl.java:142)
  |         at somewebsite.Test.call(Test.java:26)
  |         at somewebsite.Test.main(Test.java:14)
  | Caused by: java.net.ConnectException: Connection timed out: connect
  |         at java.net.PlainSocketImpl.socketConnect(Native Method)
  |         at java.net.PlainSocketImpl.doConnect(Unknown Source)
  |         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
  |         at java.net.PlainSocketImpl.connect(Unknown Source)
  |         at java.net.Socket.connect(Unknown Source)
  |         at java.net.Socket.connect(Unknown Source)
  |         at sun.net.NetworkClient.doConnect(Unknown Source)
  |         at sun.net.www.http.HttpClient.openServer(Unknown Source)
  |         at sun.net.www.http.HttpClient.openServer(Unknown Source)
  |         at sun.net.www.http.HttpClient.<init>(Unknown Source)
  |         at sun.net.www.http.HttpClient.New(Unknown Source)
  |         at sun.net.www.http.HttpClient.New(Unknown Source)
  |         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
  | Source)
  |         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
  | ce)
  |         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
  |         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
  | urce)
  |         at java.net.URL.openStream(Unknown Source)
  |         at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.getDocument(WSDLDef
  | initionsFactory.java:181)
  |         ... 9 more
  | 

Let me know if I am doing anything completely wrong? I didn't find any helpful example / issues in forums / wiki / jbossws guide to consume a .net service.

Thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973048#3973048

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973048



More information about the jboss-user mailing list