2

I'm developing an Android app which is calling a SOAP web service which is running on a GlassFish 3.1 server. I developed the web service using NetBeans 7. In my app I'm using the kSOAP2 library to connect to the server.

The connection is secured with SSL and after some problems with the certificates, a connection could be established so now I have to set he right security header of my SOAP envelope otherwise I'm getting a WssSoapFaultException: Invalid Security Header exception on the server. The problem is, I don't know how the security header should look like.

I know from this post how to set the header in general how to set soap Header using ksoap2

I tried to get some information about how the header should look like from the GlassFish Administration Tool, but couldn't find anything.

So where in the web service files can I find that information, or can I get it directly from the generated WSDL file?

This is how my WDSL file looks like.

EDIT: I realised that in the web service attributes in NetBeans (right click on the ws -> edit web service attributes) under Secure Service I chose Mutual Certificates Security. Don't know how that happend, I was sure that I checked Transport Security (SSL) when I created the web service. Anyway, I put it back to Transport Security, now the WSDL file is much lighter. But the Security Header is still needed, so I have the same problem as before.

 <!--
 Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown. 
-->
<!--
 Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown. 
-->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://stawebservice.staws.stapf.de/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://stawebservice.staws.stapf.de/" name="stawebservice">
<wsp:Policy xmlns:wsapw3c="http://www.w3.org/2006/05/addressing/wsdl" wsu:Id="stawebservicePortBinding_Wsaw_Addressing_Policy-stawebservicePortBinding_WSAM_Addressing_Policy-stawebservicePortBinding_WSAM_Addressing_Policy">
<wsapw3c:UsingAddressing wsp:Optional="true"/>
<wsam:Addressing wsp:Optional="true">
<wsp:Policy/>
</wsam:Addressing>
</wsp:Policy>
<wsp:Policy xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="stawebservicePortBindingPolicy">
<sp:TransportBinding>
<wsp:Policy>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:IncludeTimestamp/>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
</wsp:Policy>
</sp:TransportBinding>
<sp:Wss10/>
<wsam:Addressing/>
</wsp:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://stawebservice.staws.stapf.de/" schemaLocation="https://192.168.1.214:8181/STAwebservice_ssl/stawebservice?xsd=1"/>
</xsd:schema>
</types>
<message name="getPublicKey">
<part name="parameters" element="tns:getPublicKey"/>
</message>
<message name="getPublicKeyResponse">
<part name="parameters" element="tns:getPublicKeyResponse"/>
</message>
<message name="login">
<part name="parameters" element="tns:login"/>
</message>
<message name="loginResponse">
<part name="parameters" element="tns:loginResponse"/>
</message>
<message name="getOTP_HTTPS">
<part name="parameters" element="tns:getOTP_HTTPS"/>
</message>
<message name="getOTP_HTTPSResponse">
<part name="parameters" element="tns:getOTP_HTTPSResponse"/>
</message>
<message name="getOTP_SMS">
<part name="parameters" element="tns:getOTP_SMS"/>
</message>
<message name="getOTP_SMSResponse">
<part name="parameters" element="tns:getOTP_SMSResponse"/>
</message>
<message name="confirmOTP">
<part name="parameters" element="tns:confirmOTP"/>
</message>
<message name="confirmOTPResponse">
<part name="parameters" element="tns:confirmOTPResponse"/>
</message>
<portType name="stawebservice">
<operation name="getPublicKey">
<input wsaw:Action="http://stawebservice.staws.stapf.de/stawebservice/getPublicKeyRequest" wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getPublicKeyRequest" message="tns:getPublicKey"/>
<output wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getPublicKeyResponse" message="tns:getPublicKeyResponse"/>
</operation>
<operation name="login">
<input wsaw:Action="http://stawebservice.staws.stapf.de/stawebservice/loginRequest" wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/loginRequest" message="tns:login"/>
<output wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/loginResponse" message="tns:loginResponse"/>
</operation>
<operation name="getOTP_HTTPS">
<input wsaw:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_HTTPSRequest" wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_HTTPSRequest" message="tns:getOTP_HTTPS"/>
<output wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_HTTPSResponse" message="tns:getOTP_HTTPSResponse"/>
</operation>
<operation name="getOTP_SMS">
<input wsaw:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_SMSRequest" wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_SMSRequest" message="tns:getOTP_SMS"/>
<output wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/getOTP_SMSResponse" message="tns:getOTP_SMSResponse"/>
</operation>
<operation name="confirmOTP">
<input wsaw:Action="http://stawebservice.staws.stapf.de/stawebservice/confirmOTPRequest" wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/confirmOTPRequest" message="tns:confirmOTP"/>
<output wsam:Action="http://stawebservice.staws.stapf.de/stawebservice/confirmOTPResponse" message="tns:confirmOTPResponse"/>
</operation>
</portType>
<binding name="stawebservicePortBinding" type="tns:stawebservice">
<wsaw:UsingAddressing/>
<wsp:PolicyReference URI="#stawebservicePortBinding_Wsaw_Addressing_Policy-stawebservicePortBinding_WSAM_Addressing_Policy-stawebservicePortBinding_WSAM_Addressing_Policy"/>
<wsp:PolicyReference URI="#stawebservicePortBindingPolicy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getPublicKey">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="login">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getOTP_HTTPS">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getOTP_SMS">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="confirmOTP">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="stawebservice">
<port name="stawebservicePort" binding="tns:stawebservicePortBinding">
<soap:address location="https://192.168.1.214:8181/STAwebservice_ssl/stawebservice"/>
</port>
</service>
</definitions>
Community
  • 1
  • 1

0 Answers0