Hey,
I posted a couple weeks ago about problems with rampart and getting a
message "Unexpected subelement Result". I've finally had time to look
into the problem further and would really appreciate some help. As
mentioned previously my soap service works correctly without rampart
but as soon as rampart is engaged it fails instantly with the
Unexpected subelement error.
I'm setting up rampart in the axis2.xml file to use encryption as follows
<module ref="rampart" />
<parameter name="OutflowSecurity">
<action>
<items>Encrypt</items>
<encryptionUser>jontest</encryptionUser>
<passwordCallbackClass>com.mitel.me.soap.ssserver.TestCallBack</passwordCallbackClass>
<encryptionPropFile>client.properties</encryptionPropFile>
</action>
</parameter>
<parameter name="InflowSecurity">
<action>
<items>Encrypt</items>
<decryptionPropFile>client.properties</decryptionPropFile>
<passwordCallbackClass>com.mitel.me.soap.ssserver.TestCallBack</passwordCallbackClass>
</action>
</parameter>
The exception is getting thrown from an autogenerated (using
wsdl2java) parse method:
public static CmdResponse parse(javax.xml.stream.XMLStreamReader
reader) throws java.lang.Exception
the code in this method that throws the exception is
System.out.println("reader.getName() returned = " + reader.getName());
//added for debugging purposes
if (reader.isStartElement() && new
javax.xml.namespace.QName("","result").equals(reader.getName()))
{
object.setResult(com.mitel.www.mixml.ss.Result.Factory.parse(reader));
reader.next();
} // End of if for expected property start element
else
{
// A start element we are not expecting indicates an invalid
parameter was passed
throw new java.lang.RuntimeException("Unexpected subelement " +
reader.getLocalName());
}
When encryption is enabled
new javax.xml.namespace.QName("","result").equals(reader.getName())
evaluates to false and the exception gets thrown, but when encryption
is turned off there isn't an issue.
The output from the println is:
encryption off : reader.getName() returned = result
encryption on: reader.getName() returned =
{https://www.mitel.com/MiXML/ss}Result
As you can see, for some reason a namespace is present when encryption
is enabled and "Result" is also capitalized.
When enabling axis debug logs the following can be seen
Encryption off:
<ns1:LoginResponse xmlns:ns1="https://www.mitel.com/MiXML/ss">
<return>
<session>1ew3ovt7cq116f2dl4ns0</session>
<commandId>1</commandId>
<result>MissRC-Success</result>
</return>
</ns1:LoginResponse>
Encryption on:
<ns1:LoginResponse xmlns:ns1="https://www.mitel.com/MiXML/ss"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<return>
<session>18musmrpefge3f2djq7q4</session>
<commandId>1</commandId>
<ns1:Result>MissRC-Success</ns1:Result>
</return>
</ns1:LoginResponse>
As mentioned, for some reason there is namespace information present
in the result when using encryption.
The WDSL (all irrelevant stuff snipped) file that was used the
generate the stub classes is
<wsdl:definitions xmlns:tns="https://www.mitel.com/MiXML/ss"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ss="https://www.mitel.com/MiXML/ss"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="https://www.mitel.com/MiXML/ss">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="https://www.mitel.com/MiXML/ss">
<xsd:import
namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:simpleType name="Result">
<xsd:restriction base="string">
<xsd:enumeration value="MissRC-Success"
/>
<xsd:enumeration
value="MissRC-Invalid-Session-Id" />
<xsd:enumeration
value="MissRC-Invalid-Command-Id" />
<xsd:enumeration
value="MissRC-Invalid-Username" />
<xsd:enumeration
value="MissRC-Invalid-Password" />
<xsd:enumeration
value="MissRC-Invalid-ICP-IP-Address" />
<xsd:enumeration
value="MissRC-Invalid-MiXML-Version" />
<xsd:enumeration
value="MissRC-Missing-Certificate" />
<xsd:enumeration
value="MissRC-Missing-Authorization-Data" />
<xsd:enumeration
value="MissRC-Server-Error-Out-Of-Resources" />
<xsd:enumeration
value="MissRC-Server-Error-Invalid-Comment" />
<xsd:enumeration
value="MissRC-Server-Error-Invalid-ICP-In-Session" />
<xsd:enumeration
value="MissRC-Server-Error-Invalid-Versions-Buffer" />
<xsd:enumeration
value="MissRC-ICP-Communication-Failure" />
<xsd:enumeration
value="MissRC-ICP-Response-Not-Received" />
<xsd:enumeration
value="MissRC-Permissions-Problem" />
<xsd:enumeration
value="MissRC-Failed-in-ICP" />
<xsd:enumeration
value="MissRC-Security-Violation" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="CmdResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="errorString"
nillable="true"
type="string" />
<xsd:element minOccurs="0" name="session"
nillable="true" type="string" />
<xsd:element name="commandId" type="int"
/>
<xsd:element name="result"
type="ss:Result" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="LoginResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return"
type="ss:CmdResponse" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="LoginResponse">
<wsdl:part name="part1" element="tns:LoginResponse" />
</wsdl:message>
<wsdl:portType name="ssPortType">
<wsdl:operation name="Login">
<wsdl:input message="tns:Login" />
<wsdl:output
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
message="tns:LoginResponse"
wsaw:Action="https://www.mitel.com/MiXML/ss/ssPortType/LoginResponse"
/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ssSOAP11Binding" type="tns:ssPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="Login">
<soap:operation soapAction="" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ssSOAP12Binding" type="tns:ssPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="Login">
<soap12:operation soapAction="" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ss">
<wsdl:port name="ssSOAP11port_https"
binding="tns:ssSOAP11Binding">
<soap:address location="https://localhost:18000" />
</wsdl:port>
<wsdl:port name="ssSOAP12port_https"
binding="tns:ssSOAP12Binding">
<soap12:address location="https://localhost:18000" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Any help would be much appreciated as i've spent far to long trying to
debug this issue with no luck and google doesn't seem to be helping
me. If more information is needed to diagnose the problem please let
me know i can get whatever info is required.
Thanks in advance.
Jon.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]