You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Rafal Malinowski (JIRA)" <ji...@apache.org> on 2008/07/01 13:03:45 UTC

[jira] Created: (AXIS2-3882) invalid code generated for xsd:any, 'Cannot read from closed stream'

invalid code generated for xsd:any, 'Cannot read from closed stream'
--------------------------------------------------------------------

                 Key: AXIS2-3882
                 URL: https://issues.apache.org/jira/browse/AXIS2-3882
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: codegen
    Affects Versions: 1.4
         Environment: Linux, Gentoo, sun-jdk-1.6.0.06, ant 1.7.0
            Reporter: Rafal Malinowski


I am using the following wsdl file:

<?xml version="1.0"?>
<definitions name="AuthenticationService"
            targetNamespace="urn:liberty:ssos:2006-08"
            xmlns:tns="urn:liberty:ssos:2006-08"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:S="http://schemas.xmlsoap.org/wsdl/soap/"
            xmlns="http://schemas.xmlsoap.org/wsdl/"
            xmlns:ssos="urn:liberty:ssos:2006-08"
            xmlns:samlp2="urn:oasis:names:tc:SAML:2.0:protocol"
            xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
                                http://schemas.xmlsoap.org/wsdl/
                http://www.w3.org/2006/02/addressing/wsdl
                http://www.w3.org/2006/02/addressing/wsdl/ws-addr-wsdl.xsd">

    <xsd:documentation>
The source code in this WSDL file was created and changed from:

Liberty ID-WSF Liberty ID-WSF Authentication, Single Sign-On, and Identity Mapping Services Specification
Version 2.0-errata-v1.0
28 November, 2006

Copyright (c) 2007 Liberty Alliance participants, see
http://projectliberty.org/resource_center/specifications/liberty_alliance_id_wsf_2_0_specifications/idwsf_feb_copyrights

    </xsd:documentation>

    <message name="SSOSoapRequest">
        <part name="parameters" element="xsd:any"/>
    </message>
    <message name="SSOSoapResponse">
        <part name="parameters" element="xsd:any"/>
    </message>
    
    <portType name="SSOSPortType">
        <operation name="SingleSignOn">
            <input  message="ssos:SSOSoapRequest"
                wsaw:Action="urn:liberty:ssos:2006-08:AuthnRequest"/>
            <output message="ssos:SSOSoapResponse"
                wsaw:Action="urn:liberty:ssos:2006-08:Response"/>
        </operation>
    </portType>
    <binding name="SSOSSoapBinding" type="ssos:SSOSPortType">
        <S:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="SingleSignOn">
        	<S:operation soapAction="urn:liberty:ssos:2006-08:SingleSignOn" />
            <input> 
                    <S:body use="literal"/>
            </input>
            <output>
                    <S:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="SSOService">
        <port name="SSOSPortType" binding="ssos:SSOSSoapBinding">
            <S:address location="http://example.com/idmapping"/>
        </port>
    </service>
</definitions>
<?xml version="1.0"?>
<definitions name="AuthenticationService"
            targetNamespace="urn:liberty:ssos:2006-08"
            xmlns:tns="urn:liberty:ssos:2006-08"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:S="http://schemas.xmlsoap.org/wsdl/soap/"
            xmlns="http://schemas.xmlsoap.org/wsdl/"
            xmlns:ssos="urn:liberty:ssos:2006-08"
            xmlns:samlp2="urn:oasis:names:tc:SAML:2.0:protocol"
            xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
                                http://schemas.xmlsoap.org/wsdl/
                http://www.w3.org/2006/02/addressing/wsdl
                http://www.w3.org/2006/02/addressing/wsdl/ws-addr-wsdl.xsd">

    <xsd:documentation>
The source code in this WSDL file was created and changed from:

Liberty ID-WSF Liberty ID-WSF Authentication, Single Sign-On, and Identity Mapping Services Specification
Version 2.0-errata-v1.0
28 November, 2006

Copyright (c) 2007 Liberty Alliance participants, see
http://projectliberty.org/resource_center/specifications/liberty_alliance_id_wsf_2_0_specifications/idwsf_feb_copyrights

    </xsd:documentation>

    <message name="SSOSoapRequest">
        <part name="parameters" element="xsd:any"/>
    </message>
    <message name="SSOSoapResponse">
        <part name="parameters" element="xsd:any"/>
    </message>
    
    <portType name="SSOSPortType">
        <operation name="SingleSignOn">
            <input  message="ssos:SSOSoapRequest"
                wsaw:Action="urn:liberty:ssos:2006-08:AuthnRequest"/>
            <output message="ssos:SSOSoapResponse"
                wsaw:Action="urn:liberty:ssos:2006-08:Response"/>
        </operation>
    </portType>
    <binding name="SSOSSoapBinding" type="ssos:SSOSPortType">
        <S:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="SingleSignOn">
        	<S:operation soapAction="urn:liberty:ssos:2006-08:SingleSignOn" />
            <input> 
                    <S:body use="literal"/>
            </input>
            <output>
                    <S:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="SSOService">
        <port name="SSOSPortType" binding="ssos:SSOSSoapBinding">
            <S:address location="http://example.com/idmapping"/>
        </port>
    </service>
</definitions>



It uses xsd:any element as return message. I'm trying to read it with the following code:

OMElement response = ((SSOServiceStub) _stub).SingleSignOn(authnRequest);
System.out.println(response.toStringWithConsume());

(authRequest is of type OMElementImpl)


Using responseesponse.toString() I'm getting only part of oryginal xml node, with toStringWithConsume it throws exception: 


com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:927)
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:72)
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:57)
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:525)
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:795)
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814)
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:358)
org.apache.axiom.om.impl.llom.OMElementImpl.toStringWithConsume(OMElementImpl.java:904)


After modifing the stub code


//execute the operation client
_operationClient.execute(true);
         
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
   org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
                
java.lang.Object object = fromOM( 
  _returnEnv.getBody().getFirstElement() ,
  org.apache.axiom.om.OMElement.class,
  getEnvelopeNamespaces(_returnEnv));
*********************** added line ************************
object.toString(); // HACK
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
                               
return (org.apache.axiom.om.OMElement)object;

It works ok.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (AXIS2-3882) invalid code generated for xsd:any, 'Cannot read from closed stream'

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe reassigned AXIS2-3882:
----------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> invalid code generated for xsd:any, 'Cannot read from closed stream'
> --------------------------------------------------------------------
>
>                 Key: AXIS2-3882
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3882
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4
>         Environment: Linux, Gentoo, sun-jdk-1.6.0.06, ant 1.7.0
>            Reporter: Rafal Malinowski
>            Assignee: Amila Chinthaka Suriarachchi
>
> I am using the following wsdl file:
> <?xml version="1.0"?>
> <definitions name="AuthenticationService"
>             targetNamespace="urn:liberty:ssos:2006-08"
>             xmlns:tns="urn:liberty:ssos:2006-08"
>             xmlns:xs="http://www.w3.org/2001/XMLSchema"
>             xmlns:S="http://schemas.xmlsoap.org/wsdl/soap/"
>             xmlns="http://schemas.xmlsoap.org/wsdl/"
>             xmlns:ssos="urn:liberty:ssos:2006-08"
>             xmlns:samlp2="urn:oasis:names:tc:SAML:2.0:protocol"
>             xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>             xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
>                                 http://schemas.xmlsoap.org/wsdl/
>                 http://www.w3.org/2006/02/addressing/wsdl
>                 http://www.w3.org/2006/02/addressing/wsdl/ws-addr-wsdl.xsd">
>     <xsd:documentation>
> The source code in this WSDL file was created and changed from:
> Liberty ID-WSF Liberty ID-WSF Authentication, Single Sign-On, and Identity Mapping Services Specification
> Version 2.0-errata-v1.0
> 28 November, 2006
> Copyright (c) 2007 Liberty Alliance participants, see
> http://projectliberty.org/resource_center/specifications/liberty_alliance_id_wsf_2_0_specifications/idwsf_feb_copyrights
>     </xsd:documentation>
>     <message name="SSOSoapRequest">
>         <part name="parameters" element="xsd:any"/>
>     </message>
>     <message name="SSOSoapResponse">
>         <part name="parameters" element="xsd:any"/>
>     </message>
>     
>     <portType name="SSOSPortType">
>         <operation name="SingleSignOn">
>             <input  message="ssos:SSOSoapRequest"
>                 wsaw:Action="urn:liberty:ssos:2006-08:AuthnRequest"/>
>             <output message="ssos:SSOSoapResponse"
>                 wsaw:Action="urn:liberty:ssos:2006-08:Response"/>
>         </operation>
>     </portType>
>     <binding name="SSOSSoapBinding" type="ssos:SSOSPortType">
>         <S:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="SingleSignOn">
>         	<S:operation soapAction="urn:liberty:ssos:2006-08:SingleSignOn" />
>             <input> 
>                     <S:body use="literal"/>
>             </input>
>             <output>
>                     <S:body use="literal"/>
>             </output>
>         </operation>
>     </binding>
>     <service name="SSOService">
>         <port name="SSOSPortType" binding="ssos:SSOSSoapBinding">
>             <S:address location="http://example.com/idmapping"/>
>         </port>
>     </service>
> </definitions>
> <?xml version="1.0"?>
> <definitions name="AuthenticationService"
>             targetNamespace="urn:liberty:ssos:2006-08"
>             xmlns:tns="urn:liberty:ssos:2006-08"
>             xmlns:xs="http://www.w3.org/2001/XMLSchema"
>             xmlns:S="http://schemas.xmlsoap.org/wsdl/soap/"
>             xmlns="http://schemas.xmlsoap.org/wsdl/"
>             xmlns:ssos="urn:liberty:ssos:2006-08"
>             xmlns:samlp2="urn:oasis:names:tc:SAML:2.0:protocol"
>             xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>             xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
>                                 http://schemas.xmlsoap.org/wsdl/
>                 http://www.w3.org/2006/02/addressing/wsdl
>                 http://www.w3.org/2006/02/addressing/wsdl/ws-addr-wsdl.xsd">
>     <xsd:documentation>
> The source code in this WSDL file was created and changed from:
> Liberty ID-WSF Liberty ID-WSF Authentication, Single Sign-On, and Identity Mapping Services Specification
> Version 2.0-errata-v1.0
> 28 November, 2006
> Copyright (c) 2007 Liberty Alliance participants, see
> http://projectliberty.org/resource_center/specifications/liberty_alliance_id_wsf_2_0_specifications/idwsf_feb_copyrights
>     </xsd:documentation>
>     <message name="SSOSoapRequest">
>         <part name="parameters" element="xsd:any"/>
>     </message>
>     <message name="SSOSoapResponse">
>         <part name="parameters" element="xsd:any"/>
>     </message>
>     
>     <portType name="SSOSPortType">
>         <operation name="SingleSignOn">
>             <input  message="ssos:SSOSoapRequest"
>                 wsaw:Action="urn:liberty:ssos:2006-08:AuthnRequest"/>
>             <output message="ssos:SSOSoapResponse"
>                 wsaw:Action="urn:liberty:ssos:2006-08:Response"/>
>         </operation>
>     </portType>
>     <binding name="SSOSSoapBinding" type="ssos:SSOSPortType">
>         <S:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="SingleSignOn">
>         	<S:operation soapAction="urn:liberty:ssos:2006-08:SingleSignOn" />
>             <input> 
>                     <S:body use="literal"/>
>             </input>
>             <output>
>                     <S:body use="literal"/>
>             </output>
>         </operation>
>     </binding>
>     <service name="SSOService">
>         <port name="SSOSPortType" binding="ssos:SSOSSoapBinding">
>             <S:address location="http://example.com/idmapping"/>
>         </port>
>     </service>
> </definitions>
> It uses xsd:any element as return message. I'm trying to read it with the following code:
> OMElement response = ((SSOServiceStub) _stub).SingleSignOn(authnRequest);
> System.out.println(response.toStringWithConsume());
> (authRequest is of type OMElementImpl)
> Using responseesponse.toString() I'm getting only part of oryginal xml node, with toStringWithConsume it throws exception: 
> com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
> com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
> com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
> org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:927)
> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:72)
> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:57)
> org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:525)
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:795)
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:814)
> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:358)
> org.apache.axiom.om.impl.llom.OMElementImpl.toStringWithConsume(OMElementImpl.java:904)
> After modifing the stub code
> //execute the operation client
> _operationClient.execute(true);
>          
> org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
>    org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
>                 
> java.lang.Object object = fromOM( 
>   _returnEnv.getBody().getFirstElement() ,
>   org.apache.axiom.om.OMElement.class,
>   getEnvelopeNamespaces(_returnEnv));
> *********************** added line ************************
> object.toString(); // HACK
> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
>                                
> return (org.apache.axiom.om.OMElement)object;
> It works ok.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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