You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by gibyALEX <al...@gmail.com> on 2012/06/06 10:10:34 UTC

Issue with AXis2 client code connection

I am Getting error like  while using AXIs2 ....  Can any help me .. i didn't
get what is issue...

org.apache.axis2.AxisFault: Connection refused: connect
	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
	at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
	at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
	at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
	at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
	at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
	at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at
com.taleo.www.ws.tee800._2009._01.find.FindServiceStub.findPartialEntities(FindServiceStub.java:497)
	at com.taleo.demo.TaleoDemo.exportRequisition(TaleoDemo.java:101)
	at com.taleo.demo.TaleoDemo.main(TaleoDemo.java:43)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:367)
	at java.net.Socket.connect(Socket.java:524)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:592)
	at
org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
	at
org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
	at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
	at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
	at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557)
	at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
	... 10 more
The Client Code is the Below one...
--------------------------------------------------------------------------------------------------
	public static void main(String[] args) {
		TaleoDemo taleDemo = new TaleoDemo();
		String returnValue = null;
		try {
			returnValue = taleDemo.exportRequisition(pEndpoint, pUsername,
					pPassword, pPageIndex);
		} catch (RemoteException e) {
			e.printStackTrace();
		} 		
		catch (Exception ex) {
		ex.printStackTrace();
		}
		
		System.out.println("The Return value is"+returnValue);

	}

	private String exportRequisition(String pEndpoint, String pUsername,
			String pPassword, int pPageIndex) throws RemoteException,Exception {
		FindServiceStub stub = new FindServiceStub(pEndpoint);
		HttpTransportProperties.Authenticator auth = new
HttpTransportProperties.Authenticator();
		auth.setUsername(pUsername);
		auth.setPassword(pPassword);
		auth.setPreemptiveAuthentication(true);
		stub._getServiceClient().getOptions().setProperty(
				HTTPConstants.AUTHENTICATE, auth);
		FindPartialEntitiesDocument findDoc = FindPartialEntitiesDocument.Factory
				.newInstance();
		FindPartialEntitiesDocument.FindPartialEntities find = findDoc
				.addNewFindPartialEntities();
		find.setMappingVersion("http://www.taleo.com/ws/tee800/2009/01");
		SqxmlQuery sqxmlquery = find.addNewQuery();
		Query query = sqxmlquery.addNewQuery();
		query.setAlias("Find Open and Posted Requisitions");
		query.setProjectedClass("Requisition");
		Projections projections = query.addNewProjections();
		Projection contestNumberProj = projections.addNewProjection();
		Field contestNumberField = contestNumberProj.addNewField();
		contestNumberField.setPath("ContestNumber");
		Projection jobInfoTitleProj = projections.addNewProjection();
		Field jobInfoTitleField = jobInfoTitleProj.addNewField();
		jobInfoTitleField.setPath("JobInformation,Title");
		Filterings filterings = query.addNewFilterings();
		Filtering filtering = filterings.addNewFiltering();
		IncludedIn includedIn = filtering.addNewIncludedIn();
		Field stateField = includedIn.addNewField();
		stateField.setPath("State,Number");
		List stateList = includedIn.addNewList();
		Long open = stateList.addNewLong();
		open.setLongValue(3);
		Long posted = stateList.addNewLong();
		posted.setLongValue(13);
		Sortings sortings = query.addNewSortings();
		Sorting sorting = sortings.addNewSorting();
		Field contestNumberSortingField = sorting.addNewField();
		contestNumberSortingField.setPath("ContestNumber");
		String2StringMap attrs = find.addNewAttributes();
		Entry entry = attrs.addNewEntry();
		entry.setKey("pageindex");
		entry.setValue(String.valueOf(pPageIndex));
		FindPartialEntitiesResponseDocument response;
		try {
			response = stub.findPartialEntities(findDoc);
		} catch (WebServiceFault e) {
			System.err.println("Error while creating the candidate: "
					+ e.getFaultMessage().getWebServiceFault().getMessage());
			throw new RuntimeException(e);
		}
		FindPartialEntitiesResponse rsp = response
				.getFindPartialEntitiesResponse();
		Entities entities = rsp.getEntities();
		System.out.println("Fetched page: " + entities.getPageIndex() + "/"
				+ entities.getPageCount());
		if (!entities.getPageCount().equals(entities.getPageIndex())) {
			return exportRequisition(pEndpoint, pUsername, pPassword,
					+pPageIndex);
		} else {
			Requisition requisition = (Requisition)
entities.getEntityArray()[entities
					.sizeOfEntityArray() - 1];
			return requisition.getContestNumber();
		}
	}

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

etting error like ....
-- 
View this message in context: http://old.nabble.com/Issue-with-AXis2-client-code-connection-tp33968566p33968566.html
Sent from the Axis - User mailing list archive at Nabble.com.

RE: Issue with AXis2 client code connection

Posted by James Annesley <ja...@infoshare-is.com>.
Hi,

 

"Connection refused: connect at org.apache.axis2." just means it can't
access the SOAP endpoint. Make sure the SOAP server is running and available
and that the client is pointing to it. The parameters when creating a stub
are where you define the endpoint location. As far as the server goes make
sure that you can access it through another means on the server and on
client. E.g. this could be a web browser or another SOAP client. If you can
access it on the server but not the client then it could be a firewall
problem and you should open the correct port on the server.

 

James

 

From: gibyALEX [mailto:alexgiby@gmail.com] 
Sent: 06 June 2012 09:11
To: axis-user@ws.apache.org
Subject: Issue with AXis2 client code connection

 

I am Getting error like while using AXIs2 .... Can any help me .. i didn't
get what is issue... org.apache.axis2.AxisFault: Connection refused: connect
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76) at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:400) at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:225) at
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438) at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:402) at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:229) at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at
com.taleo.www.ws.tee800._2009._01.find.FindServiceStub.findPartialEntities(F
indServiceStub.java:497) at
com.taleo.demo.TaleoDemo.exportRequisition(TaleoDemo.java:101) at
com.taleo.demo.TaleoDemo.main(TaleoDemo.java:43) Caused by:
java.net.ConnectException: Connection refused: connect at
java.net.PlainSocketImpl.socketConnect(Native Method) at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:367) at
java.net.Socket.connect(Socket.java:524) at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at
org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(
ReflectionSocketFactory.java:140) at
org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket
(SSLProtocolSocketFactory.java:130) at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnect
ionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethod
Director.java:387) at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDir
ector.java:171) at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTT
PSender.java:557) at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
... 10 more The Client Code is the Below one...
----------------------------------------------------------------------------
---------------------- public static void main(String[] args) { TaleoDemo
taleDemo = new TaleoDemo(); String returnValue = null; try { returnValue =
taleDemo.exportRequisition(pEndpoint, pUsername, pPassword, pPageIndex); }
catch (RemoteException e) { e.printStackTrace(); } catch (Exception ex) {
ex.printStackTrace(); } System.out.println("The Return value
is"+returnValue); } private String exportRequisition(String pEndpoint,
String pUsername, String pPassword, int pPageIndex) throws
RemoteException,Exception { FindServiceStub stub = new
FindServiceStub(pEndpoint); HttpTransportProperties.Authenticator auth = new
HttpTransportProperties.Authenticator(); auth.setUsername(pUsername);
auth.setPassword(pPassword); auth.setPreemptiveAuthentication(true);
stub._getServiceClient().getOptions().setProperty(
HTTPConstants.AUTHENTICATE, auth); FindPartialEntitiesDocument findDoc =
FindPartialEntitiesDocument.Factory .newInstance();
FindPartialEntitiesDocument.FindPartialEntities find = findDoc
.addNewFindPartialEntities();
find.setMappingVersion("http://www.taleo.com/ws/tee800/2009/01"); SqxmlQuery
sqxmlquery = find.addNewQuery(); Query query = sqxmlquery.addNewQuery();
query.setAlias("Find Open and Posted Requisitions");
query.setProjectedClass("Requisition"); Projections projections =
query.addNewProjections(); Projection contestNumberProj =
projections.addNewProjection(); Field contestNumberField =
contestNumberProj.addNewField();
contestNumberField.setPath("ContestNumber"); Projection jobInfoTitleProj =
projections.addNewProjection(); Field jobInfoTitleField =
jobInfoTitleProj.addNewField();
jobInfoTitleField.setPath("JobInformation,Title"); Filterings filterings =
query.addNewFilterings(); Filtering filtering =
filterings.addNewFiltering(); IncludedIn includedIn =
filtering.addNewIncludedIn(); Field stateField = includedIn.addNewField();
stateField.setPath("State,Number"); List stateList =
includedIn.addNewList(); Long open = stateList.addNewLong();
open.setLongValue(3); Long posted = stateList.addNewLong();
posted.setLongValue(13); Sortings sortings = query.addNewSortings(); Sorting
sorting = sortings.addNewSorting(); Field contestNumberSortingField =
sorting.addNewField(); contestNumberSortingField.setPath("ContestNumber");
String2StringMap attrs = find.addNewAttributes(); Entry entry =
attrs.addNewEntry(); entry.setKey("pageindex");
entry.setValue(String.valueOf(pPageIndex));
FindPartialEntitiesResponseDocument response; try { response =
stub.findPartialEntities(findDoc); } catch (WebServiceFault e) {
System.err.println("Error while creating the candidate: " +
e.getFaultMessage().getWebServiceFault().getMessage()); throw new
RuntimeException(e); } FindPartialEntitiesResponse rsp = response
.getFindPartialEntitiesResponse(); Entities entities = rsp.getEntities();
System.out.println("Fetched page: " + entities.getPageIndex() + "/" +
entities.getPageCount()); if
(!entities.getPageCount().equals(entities.getPageIndex())) { return
exportRequisition(pEndpoint, pUsername, pPassword, +pPageIndex); } else {
Requisition requisition = (Requisition) entities.getEntityArray()[entities
.sizeOfEntityArray() - 1]; return requisition.getContestNumber(); } }
----------------------------------------------------------------------
etting error like .... 

  _____  

View this message in context: Issue with AXis2 client code connection
<http://old.nabble.com/Issue-with-AXis2-client-code-connection-tp33968566p33
968566.html> 
Sent from the Axis - User mailing list archive
<http://old.nabble.com/Axis---User-f232.html>  at Nabble.com.


The content of this e-mail (and any attachment to it) is confidential. 
Any views or opinions do not represent the views or opinions 
of Infoshare Ltd.
If you have received this e-mail in error please notify the sender 
and delete it. You may not use, copy or disclose the information 
in any way. 

Infoshare Ltd monitors incoming and outgoing e-mails.

Please consider the environment. Do you really need to print 
this email?