none
axis2-1.6.2 use wsdl2java Call WCF error RRS feed

  • 问题

  • Hello:IuseAxis2 code generatorgeneratesclient code, and then callservices, reportedthe following error, but also hopesomeone canguide theyounger brother,began to learnaxis2.Thank you

    Given the following information:

    log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisOperation).
    log4j:WARN Please initialize the log4j system properly.
    org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
    at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.tempuri.EhiServiceStub.getCitiesList(EhiServiceStub.java:631)
    at Test.GetWcfTOJava(Test.java:37)
    at Test.main(Test.java:16)

    Calling code:

    import org.tempuri.EhiServiceCallbackHandler;
    import org.tempuri.EhiServiceStub;
    import org.tempuri.GetCitiesList;
    import org.tempuri.GetCitiesListResponse;
    import ehiservicedatacontract.EhiServiceRequestData;
    public class Test {
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		GetWcfTOJava();
    	}
    	
    	public static void GetWcfTOJava()
    	{
    		try {
    			String tager="http://demo.1hai.cn/service/EhiService.svc";
    			  org.tempuri.EhiServiceStub stub =
                      new org.tempuri.EhiServiceStub();//the default implementation should point to the right endpoint
    			  
             org.tempuri.GetCitiesList getCitiesList98=
                                                          (org.tempuri.GetCitiesList)getTestObject(org.tempuri.GetCitiesList.class);
             //Visit this wcf requires a username and password
             EhiServiceRequestData eh=new EhiServiceRequestData();
             eh.setUserName("100001");
             eh.setPassword("123456");
             eh.setRequestContent("<GetCitiesListRequest/>");
             getCitiesList98.setRequestData(eh);
             System.out.println(stub.getCitiesList(getCitiesList98).getGetCitiesListResult());
    		} catch (Exception e) {
    			// TODO: handle exception
    			e.printStackTrace();
    		}
    	}
    	
        //Create an ADBBean and provide it as the test object
        public static org.apache.axis2.databinding.ADBBean getTestObject(java.lang.Class type) throws java.lang.Exception{
           return (org.apache.axis2.databinding.ADBBean) type.newInstance();
        }
    }

    2013年5月30日 2:34

答案