LuisCastilloSalinas / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

kSOAP2 and SOAPAction on Android #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hi everyone, I am trying to access a Webservice with kSOAP2 on an Android
Phone. I think the connection is being established, but the server won't
answer my request since I'm not providing a SOAP Action Header which seems
to be required in SOAP Version 1.1(please correct me if I'm wrong here)
which I have to use since the server does not support Version 1.2 . The
concrete Faultcode which is returning in the request looks like this:

faultactor  null    
faultcode   "S:Server" (id=830064966432)    
faultstring "String index out of range: -11" (id=830064966736)

The errorcode which is generated on the server (I'm running it on a
localhost) looks like this:

4.05.2010 20:20:29 com.sun.xml.internal.ws.transport.http.HttpAdapter
fixQuotesAroundSoapAction
WARNUNG: Received WS-I BP non-conformant Unquoted SoapAction HTTP header:
http://server.contextlayer.bscwi.de/createContext
24.05.2010 20:20:29
com.sun.xml.internal.ws.server.sei.EndpointMethodHandler invoke
SCHWERWIEGEND: String index out of range: -11
java.lang.StringIndexOutOfBoundsException: String index out of range: -11
    at java.lang.String.substring(Unknown Source)
    at de.bscwi.contextlayer.xml.XmlValidator.isValid(XmlValidator.java:41)
    at de.bscwi.contextlayer.server.ContextWS.createContext(ContextWS.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(Unknown
Source)
    at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(Unknown Source)
    at
com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(Unknown Source)
    at
com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(Unknown
Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
    at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(Unknown Source)
    at
com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(Unknown
Source)
    at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(Unknown
Source)
    at
com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(Unkno
wn
Source)
    at
com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(Unknown
Source)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
    at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown
Source)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
    at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

The relevant part of the WSDL (at least that's what I'm thinking) looks
like this:

<operation name="createContext">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal" namespace="http://server.contextlayer.bscwi.de/"/>
</input>
−
<output>
<soap:body use="literal" namespace="http://server.contextlayer.bscwi.de/"/>
</output>
</operation>    

In my code I'm adding a Header, but it seems like I'm doing it wrong:

private static final String SOAP_ACTION  = "";
//...
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope
(SoapEnvelope.VER11);
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht = new AndroidHttpTransport (URL);
//...
aht.call(SOAP_ACTION, soapEnvelope);
        SoapPrimitive resultString = (SoapPrimitive)
soapEnvelope.getResponse();

Any advice would be great since I'm running out of ideas.. Thanks folks!
Note: I also posted this at StackOverflow.com
(http://stackoverflow.com/questions/2899392/ksoap2-and-soapaction-on-android)

Original issue reported on code.google.com by matze-ch...@gmx.de on 24 May 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Soap Action is an empty string. That wont work. There is no problem with the 
library here.. 

Original comment by mosa...@gmail.com on 12 Oct 2010 at 7:05