WCF Service, Java JApplet client, transport error 405

Posted by Juan Zamudio on Stack Overflow See other posts from Stack Overflow or by Juan Zamudio
Published on 2009-11-10T01:13:28Z Indexed on 2010/05/24 3:11 UTC
Read the original article Hit count: 596

Filed under:
|
|

Hi all, I'm having a problem with a WCF Service and Java Client, I will try to give as much information as i can, thanks for your time.

The Endpoint of the server is BasicHttpBinding, I tried hosting the server as a Windows Service and in IIS but nothing changed. The weird thing is that the Client works great if I use a simple class, in the moment I switch the class to an JApplet I get the problem mentioned.

I'm using Eclipse as an IDE, I tried Axis and Metro to generate the stub with the same bad results.

Here is an example of the Java class where everything is working

public class TestSoaMetro {
    public String TestMethod(){
    	String result=null;

    		IDigitalSignatureService aa = new DigitalSignatureService().getBasicHttpBindingEndpoint();
    		try {
    			result= aa.getData("1", "id002962");
    		} catch (IDigitalSignatureServiceGetDataArgumentExceptionFaultFaultMessage e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} catch (IDigitalSignatureServiceGetDataInvalidOperationExceptionFaultFaultMessage e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	return result;
    }
}

Here is the example of the JApplet where I get the error:

public class TestSoaMetroApplet extends JApplet {
     public void init() {
    	    Container content = getContentPane();
    	    content.setBackground(Color.white);
    	    content.setLayout(new FlowLayout()); 
    	    String result= this.TestMethod();
    	    JLabel label = new JLabel(result);
    	    content.add(label);
    	  }
    public String TestMethod(){
    	String result=null;
    	IDigitalSignatureService aa = null;
    	try {
    		aa = new DigitalSignatureService().getBasicHttpBindingEndpoint();
    		result= aa.getData("1", "id002962");
    	} catch (IDigitalSignatureServiceGetDataArgumentExceptionFaultFaultMessage e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	} catch (IDigitalSignatureServiceGetDataInvalidOperationExceptionFaultFaultMessage e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	}
    return result;
    }
}

In the moment the Applet loads I get the error, is the exact same call so I don't understand why I get the exception using the Applet. I Also tried to call this from a Silverlight client and I was getting a security exception, this is where I found out about clientaccesspolicy.xml and crossdomain.xml, I added clientaccesspolicy.xml to the service and the Silverlight Client works great, so I decided to try crossdomain.xml and nothing, the Applet still does not work. I will put the stack trace at the end, thanks all for your time.

Juan Zamudio

javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: Transport error: 405 Error: Method not allowed
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:559)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:118)
at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:82)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:317)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:159)
at $Proxy12.getData(Unknown Source)
at TestSoaMetroApplet.TestMethod(TestSoaMetroApplet.java:28)
at TestSoaMetroApplet.init(TestSoaMetroApplet.java:19)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.axis2.AxisFault: Transport error: 405 Error: Method not allowed
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:295)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:190)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:389)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:222)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
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 org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:554)
... 9 more

© Stack Overflow or respective owner

Related posts about java

Related posts about wcf