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 Sukma Agung Verdianto <sa...@gmail.com> on 2007/05/14 09:41:50 UTC

How to change message ContentType???

Hi All,

I was trying to change message content type so I hope the message
comes from axis accepted by WCF service deployed in IIS.

I get exception like this:

org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
process the message because the content type 'text/xml; charset=UTF-8'
was not the expected type 'application/soap+xml; charset=utf-8'.';
nested exception is:
	org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
process the message because the content type 'text/xml; charset=UTF-8'
was not the expected type 'application/soap+xml; charset=utf-8'.';
nested exception is:
	org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
process the message because the content type 'text/xml; charset=UTF-8'
was not the expected type 'application/soap+xml; charset=utf-8'.';
nested exception is:
	org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
process the message because the content type 'text/xml; charset=UTF-8'
was not the expected type 'application/soap+xml; charset=utf-8'.'
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
	at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
	at org.tempuri.CalculatorServiceStub.Add(CalculatorServiceStub.java:693)
	at org.tempuri.CalculatorServiceTest.testAdd(CalculatorServiceTest.java:92)
	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:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
'Cannot process the message because the content type 'text/xml;
charset=UTF-8' was not the expected type 'application/soap+xml;
charset=utf-8'.'; nested exception is:
	org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
process the message because the content type 'text/xml; charset=UTF-8'
was not the expected type 'application/soap+xml; charset=utf-8'.'
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:344)
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
	... 23 more
Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
'Cannot process the message because the content type 'text/xml;
charset=UTF-8' was not the expected type 'application/soap+xml;
charset=utf-8'.'
	at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:144)
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
	... 24 more


I'm trying to add  this following lines to the client code:


        stub = new
CalculatorServiceStub("http://localhost:8888/servicemodelsamples/service.svc?wsdl");

        ServiceClient sc = stub._getServiceClient();
        Options options = sc.getOptions();
        options.setProperty(HTTPConstants.CONTENT_TYPE, "application/soap+xml");
        options.setProperty(HTTPConstants.CHAR_SET_ENCODING, "utf-8");
        options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy(this.getClass().getResource("/META-INF/policy.xml").getFile()));

        sc.setOptions(options);

        stub._setServiceClient(sc);


but I still received the same error.

Here is also the SOAP message headers captured from TCPMon, looks like
the code does not change the content type & charset

POST /servicemodelsamples/service.svc?wsdl HTTP/1.1
SOAPAction: "http://Microsoft.ServiceModel.Samples/ICalculator/Divide"
User-Agent: Axis2
Host: 192.168.0.11:8888
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8


Thanks

Sukma

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How to change message ContentType???

Posted by Sukma Agung Verdianto <sa...@gmail.com>.
Thanks Keith,

Now I can see the message content type changed to application/soap+xml. :)

Regards,
Sukma

On 5/16/07, keith chapman <ke...@gmail.com> wrote:
> Hi Sukma,
>
> Seems like you should be changing the soap version here. text/xml is the
> content type for SOAP 1.1 whereas application/soap+xml is the content type
> os SOAP 1.2. It looks like the server expects SOAP 1.2, you can do this by
> setting the following property
>
> options.setSoapVersionURI(org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>
> This will automatically take care of setting the relavant content type.
>
> Thanks,
> Keith.
>
>
>  On 5/16/07, Sukma Agung Verdianto <sa...@gmail.com> wrote:
> >
> > Hi All,
> >
> > Sorry, I resend this email. I didn't get any feedback on this.
> > Can someone please explain to me wether I could do this or not?
> > I really need to change the message http content type so other WS
> > implementstion (WCF) service can accept any messages sent by Axis2.
> > Because WCF expect to accept message with application/soap+xml
> > message. Thanks
> >
> > Regards,
> > Sukma
> >
> >
> > On 5/14/07, Sukma Agung Verdianto < save.nx@gmail.com> wrote:
> > > Hi All,
> > >
> > > I was trying to change message content type so I hope the message
> > > comes from axis accepted by WCF service deployed in IIS.
> > >
> > > I get exception like this:
> > >
> > > org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> > > process the message because the content type 'text/xml; charset=UTF-8'
> > > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > > nested exception is:
> > >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > > process the message because the content type 'text/xml; charset=UTF-8'
> > > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > > nested exception is:
> > >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > > process the message because the content type 'text/xml; charset=UTF-8'
> > > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > > nested exception is:
> > >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > > process the message because the content type 'text/xml; charset=UTF-8'
> > > was not the expected type 'application/soap+xml; charset=utf-8'.'
> > >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
> > >         at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
> > >         at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
> > >         at
> org.apache.axis2.description.OutInAxisOperationClient.execute
> (OutInAxisOperation.java:202)
> > >         at
> org.tempuri.CalculatorServiceStub.Add(CalculatorServiceStub.java:693)
> > >         at
> org.tempuri.CalculatorServiceTest.testAdd(CalculatorServiceTest.java:92)
> > >         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:585)
> > >         at
> junit.framework.TestCase.runTest(TestCase.java:154)
> > >         at junit.framework.TestCase.runBare
> (TestCase.java:127)
> > >         at
> junit.framework.TestResult$1.protect(TestResult.java:106)
> > >         at
> junit.framework.TestResult.runProtected(TestResult.java:124)
> > >         at junit.framework.TestResult.run (TestResult.java:109)
> > >         at junit.framework.TestCase.run(TestCase.java:118)
> > >         at
> junit.framework.TestSuite.runTest(TestSuite.java:208)
> > >         at junit.framework.TestSuite.run(TestSuite.java :203)
> > >         at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> > >         at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> > >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> > >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> > >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> > >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> > > Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> > > 'Cannot process the message because the content type 'text/xml;
> > > charset=UTF-8' was not the expected type 'application/soap+xml;
> > > charset=utf-8'.'; nested exception is:
> > >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > > process the message because the content type 'text/xml; charset=UTF-8'
> > > was not the expected type 'application/soap+xml; charset=utf-8'.'
> > >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:344)
> > >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
> > >         ... 23 more
> > > Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> > > 'Cannot process the message because the content type 'text/xml;
> > > charset=UTF-8' was not the expected type 'application/soap+xml;
> > > charset=utf-8'.'
> > >         at
> org.apache.axis2.transport.http.SOAPOverHTTPSender.send
> (SOAPOverHTTPSender.java:144)
> > >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
> > >         ... 24 more
> > >
> > >
> > > I'm trying to add  this following lines to the client code:
> > >
> > >
> > >         stub = new
> > >
> CalculatorServiceStub("http://localhost:8888/servicemodelsamples/service.svc?wsdl");
> > >
> > >         ServiceClient sc = stub._getServiceClient();
> > >         Options options = sc.getOptions();
> > >         options.setProperty(HTTPConstants.CONTENT_TYPE,
> "application/soap+xml");
> > >         options.setProperty(HTTPConstants.CHAR_SET_ENCODING, "utf-8");
> > >
> options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
> > >
> loadPolicy(this.getClass().getResource("/META-INF/policy.xml").getFile()));
> > >
> > >         sc.setOptions(options);
> > >
> > >         stub._setServiceClient(sc);
> > >
> > >
> > > but I still received the same error.
> > >
> > > Here is also the SOAP message headers captured from TCPMon, looks like
> > > the code does not change the content type & charset
> > >
> > > POST /servicemodelsamples/service.svc?wsdl HTTP/1.1
> > > SOAPAction: "
> http://Microsoft.ServiceModel.Samples/ICalculator/Divide"
> > > User-Agent: Axis2
> > > Host: 192.168.0.11:8888
> > > Transfer-Encoding: chunked
> > > Content-Type: text/xml; charset=UTF-8
> > >
> > >
> > > Thanks
> > >
> > > Sukma
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
>
> --
> Keith Chapman
> WSO2 Inc.
> Oxygen for Web Services Developers.
> http://wso2.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How to change message ContentType???

Posted by keith chapman <ke...@gmail.com>.
Hi Sukma,

Seems like you should be changing the soap version here. text/xml is the
content type for SOAP 1.1 whereas application/soap+xml is the content type
os SOAP 1.2. It looks like the server expects SOAP 1.2, you can do this by
setting the following property

options.setSoapVersionURI(
org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

This will automatically take care of setting the relavant content type.

Thanks,
Keith.

On 5/16/07, Sukma Agung Verdianto <sa...@gmail.com> wrote:
>
> Hi All,
>
> Sorry, I resend this email. I didn't get any feedback on this.
> Can someone please explain to me wether I could do this or not?
> I really need to change the message http content type so other WS
> implementstion (WCF) service can accept any messages sent by Axis2.
> Because WCF expect to accept message with application/soap+xml
> message. Thanks
>
> Regards,
> Sukma
>
>
> On 5/14/07, Sukma Agung Verdianto <sa...@gmail.com> wrote:
> > Hi All,
> >
> > I was trying to change message content type so I hope the message
> > comes from axis accepted by WCF service deployed in IIS.
> >
> > I get exception like this:
> >
> > org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> > process the message because the content type 'text/xml; charset=UTF-8'
> > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > nested exception is:
> >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > process the message because the content type 'text/xml; charset=UTF-8'
> > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > nested exception is:
> >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > process the message because the content type 'text/xml; charset=UTF-8'
> > was not the expected type 'application/soap+xml; charset=utf-8'.';
> > nested exception is:
> >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > process the message because the content type 'text/xml; charset=UTF-8'
> > was not the expected type 'application/soap+xml; charset=utf-8'.'
> >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> CommonsHTTPTransportSender.java:227)
> >         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
> >         at org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:237)
> >         at org.apache.axis2.description.OutInAxisOperationClient.execute
> (OutInAxisOperation.java:202)
> >         at org.tempuri.CalculatorServiceStub.Add(
> CalculatorServiceStub.java:693)
> >         at org.tempuri.CalculatorServiceTest.testAdd(
> CalculatorServiceTest.java:92)
> >         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:585)
> >         at junit.framework.TestCase.runTest(TestCase.java:154)
> >         at junit.framework.TestCase.runBare(TestCase.java:127)
> >         at junit.framework.TestResult$1.protect(TestResult.java:106)
> >         at junit.framework.TestResult.runProtected(TestResult.java:124)
> >         at junit.framework.TestResult.run(TestResult.java:109)
> >         at junit.framework.TestCase.run(TestCase.java:118)
> >         at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >         at junit.framework.TestSuite.run(TestSuite.java:203)
> >         at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(
> JUnit3TestReference.java:128)
> >         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
> TestExecution.java:38)
> >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
> >         at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:673)
> >         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
> >         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
> RemoteTestRunner.java:196)
> > Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> > 'Cannot process the message because the content type 'text/xml;
> > charset=UTF-8' was not the expected type 'application/soap+xml;
> > charset=utf-8'.'; nested exception is:
> >         org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot
> > process the message because the content type 'text/xml; charset=UTF-8'
> > was not the expected type 'application/soap+xml; charset=utf-8'.'
> >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
> (CommonsHTTPTransportSender.java:344)
> >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> CommonsHTTPTransportSender.java:204)
> >         ... 23 more
> > Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> > 'Cannot process the message because the content type 'text/xml;
> > charset=UTF-8' was not the expected type 'application/soap+xml;
> > charset=utf-8'.'
> >         at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(
> SOAPOverHTTPSender.java:144)
> >         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
> (CommonsHTTPTransportSender.java:335)
> >         ... 24 more
> >
> >
> > I'm trying to add  this following lines to the client code:
> >
> >
> >         stub = new
> > CalculatorServiceStub("
> http://localhost:8888/servicemodelsamples/service.svc?wsdl");
> >
> >         ServiceClient sc = stub._getServiceClient();
> >         Options options = sc.getOptions();
> >         options.setProperty(HTTPConstants.CONTENT_TYPE,
> "application/soap+xml");
> >         options.setProperty(HTTPConstants.CHAR_SET_ENCODING, "utf-8");
> >         options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
> > loadPolicy(this.getClass
> ().getResource("/META-INF/policy.xml").getFile()));
> >
> >         sc.setOptions(options);
> >
> >         stub._setServiceClient(sc);
> >
> >
> > but I still received the same error.
> >
> > Here is also the SOAP message headers captured from TCPMon, looks like
> > the code does not change the content type & charset
> >
> > POST /servicemodelsamples/service.svc?wsdl HTTP/1.1
> > SOAPAction: "http://Microsoft.ServiceModel.Samples/ICalculator/Divide"
> > User-Agent: Axis2
> > Host: 192.168.0.11:8888
> > Transfer-Encoding: chunked
> > Content-Type: text/xml; charset=UTF-8
> >
> >
> > Thanks
> >
> > Sukma
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/

Re: How to change message ContentType???

Posted by Sukma Agung Verdianto <sa...@gmail.com>.
Hi All,

Sorry, I resend this email. I didn't get any feedback on this.
Can someone please explain to me wether I could do this or not?
I really need to change the message http content type so other WS
implementstion (WCF) service can accept any messages sent by Axis2.
Because WCF expect to accept message with application/soap+xml
message. Thanks

Regards,
Sukma


On 5/14/07, Sukma Agung Verdianto <sa...@gmail.com> wrote:
> Hi All,
>
> I was trying to change message content type so I hope the message
> comes from axis accepted by WCF service deployed in IIS.
>
> I get exception like this:
>
> org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> process the message because the content type 'text/xml; charset=UTF-8'
> was not the expected type 'application/soap+xml; charset=utf-8'.';
> nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> process the message because the content type 'text/xml; charset=UTF-8'
> was not the expected type 'application/soap+xml; charset=utf-8'.';
> nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> process the message because the content type 'text/xml; charset=UTF-8'
> was not the expected type 'application/soap+xml; charset=utf-8'.';
> nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> process the message because the content type 'text/xml; charset=UTF-8'
> was not the expected type 'application/soap+xml; charset=utf-8'.'
>         at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
>         at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
>         at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
>         at org.tempuri.CalculatorServiceStub.Add(CalculatorServiceStub.java:693)
>         at org.tempuri.CalculatorServiceTest.testAdd(CalculatorServiceTest.java:92)
>         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:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
>         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot process the message because the content type 'text/xml;
> charset=UTF-8' was not the expected type 'application/soap+xml;
> charset=utf-8'.'; nested exception is:
>         org.apache.axis2.AxisFault: HTTP Transport error : '415' - 'Cannot
> process the message because the content type 'text/xml; charset=UTF-8'
> was not the expected type 'application/soap+xml; charset=utf-8'.'
>         at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:344)
>         at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
>         ... 23 more
> Caused by: org.apache.axis2.AxisFault: HTTP Transport error : '415' -
> 'Cannot process the message because the content type 'text/xml;
> charset=UTF-8' was not the expected type 'application/soap+xml;
> charset=utf-8'.'
>         at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:144)
>         at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
>         ... 24 more
>
>
> I'm trying to add  this following lines to the client code:
>
>
>         stub = new
> CalculatorServiceStub("http://localhost:8888/servicemodelsamples/service.svc?wsdl");
>
>         ServiceClient sc = stub._getServiceClient();
>         Options options = sc.getOptions();
>         options.setProperty(HTTPConstants.CONTENT_TYPE, "application/soap+xml");
>         options.setProperty(HTTPConstants.CHAR_SET_ENCODING, "utf-8");
>         options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
> loadPolicy(this.getClass().getResource("/META-INF/policy.xml").getFile()));
>
>         sc.setOptions(options);
>
>         stub._setServiceClient(sc);
>
>
> but I still received the same error.
>
> Here is also the SOAP message headers captured from TCPMon, looks like
> the code does not change the content type & charset
>
> POST /servicemodelsamples/service.svc?wsdl HTTP/1.1
> SOAPAction: "http://Microsoft.ServiceModel.Samples/ICalculator/Divide"
> User-Agent: Axis2
> Host: 192.168.0.11:8888
> Transfer-Encoding: chunked
> Content-Type: text/xml; charset=UTF-8
>
>
> Thanks
>
> Sukma
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org