On Tue, May 25, 2010 at 12:45 PM, Gregor Kiddie
<[email protected]> wrote:
>
>
> -----Original Message-----
> From: Simon Laws [mailto:[email protected]]
> Sent: 25 May 2010 11:47
> To: [email protected]
> Subject: Re: Exception with security (again)
>
> On Mon, May 24, 2010 at 5:50 PM, Gregor Kiddie
> <[email protected]> wrote:
>>
>>
>> -----Original Message-----
>> From: Simon Laws [mailto:[email protected]]
>> Sent: 24 May 2010 17:01
>> To: [email protected]
>> Subject: Re: Exception with security (again)
>>
>> On Mon, May 24, 2010 at 3:47 PM, Gregor Kiddie
>> <[email protected]> wrote:
>>>
>>>
>>> -----Original Message-----
>>> From: Simon Laws [mailto:[email protected]]
>>> Sent: 24 May 2010 15:24
>>> To: [email protected]
>>> Subject: Re: Exception with security (again)
>>>
>>> On Mon, May 24, 2010 at 2:40 PM, Gregor Kiddie
>>> <[email protected]> wrote:
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Simon Laws [mailto:[email protected]]
>>>> Sent: 24 May 2010 13:54
>>>> To: [email protected]
>>>> Subject: Re: Exception with security (again)
>>>>
>>>> On Mon, May 24, 2010 at 11:03 AM, Gregor Kiddie
>>>> <[email protected]> wrote:
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Simon Laws [mailto:[email protected]]
>>>>> Sent: 24 May 2010 09:54
>>>>> To: [email protected]
>>>>> Subject: Re: Exception with security (again)
>>>>>
>>>>> On Fri, May 21, 2010 at 8:17 PM, Gregor Kiddie
>>>>> <[email protected]> wrote:
>>>>>> Ok, last one before I leave for the weekend cursing Tuscany!
>>>>>>
>>>>>>
>>>>>>
>>>>>> Using an authentication policy on a binding.ws generates the following
>>>>>> exception.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>>>>>>
>>>>>> at
>>>>>> org.apache.tuscany.sca.databinding.axiom.OMElementWrapperHandler.setChildren(OMElementWrapperHandler.java:76)
>>>>>>
>>>>>> It looks like childObjects passed into the method has all the parameters
>>>>>> wrapped up in a single piece of XML
>>>>>>
>>>>>> The ChildElements which is pulled from the operation which is passed in,
>>>>>> has
>>>>>> them split up into three Elements.
>>>>>>
>>>>>>
>>>>>>
>>>>>> The loop in setChildren uses the size of the ChildElements as it's upper
>>>>>> bounds and references both objects. Unsurprisingly, when it gets to
>>>>>> childObjects[1] it blows up.
>>>>>>
>>>>>>
>>>>>>
>>>>>> I've been running through everything for a couple of hours and I'm now
>>>>>> calling defeat. I'm close to dumping Tuscany for this!
>>>>>>
>>>>>>
>>>>>>
>>>>>> Gk.
>>>>>
>>>>> Hi Gregor
>>>>>
>>>>> Sorry that you're having a frustrating time. Can you describe your
>>>>> scenario so I can reproduce it here.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Simon
>>>>>
>>>>>
>>>>> --
>>>>> Apache Tuscany committer: tuscany.apache.org
>>>>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>>>>
>>>>> My Composite looks like
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
>>>>> targetNamespace="com.mycompany.myproduct.authentication"
>>>>> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
>>>>> name="authentication" >
>>>>>
>>>>> <component name="Authentication">
>>>>> <implementation.spring
>>>>> location="WEB-INF/classes/applicationContext.xml" />
>>>>> <service name="Authentication">
>>>>> <binding.ws />
>>>>> </service>
>>>>> <reference name="authenticationProvider" >
>>>>> <binding.ws
>>>>> wsdlElement="http://soa.mycompany.com/webservices/#wsdl.port(MyService/MyServiceSoap12)"
>>>>> requires="authentication" />
>>>>> </reference>
>>>>> </component>
>>>>> </composite>
>>>>>
>>>>> My definitions file looks like
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
>>>>> xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
>>>>>
>>>>> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
>>>>> targetNamespace="com.mycompany.richfx.policy" >
>>>>>
>>>>> <policySet name="myCompanyPolicySet" provides="authentication"
>>>>> appliesTo="sca:binding.ws">
>>>>> <tuscany:basicAuthentication>
>>>>> <tuscany:userName>someusername</tuscany:userName>
>>>>> <tuscany:password>some-password</tuscany:password>
>>>>> </tuscany:basicAuthentication>
>>>>> </policySet>
>>>>> </definitions>
>>>>>
>>>>> Application starts up fine, but when I make the call to the external
>>>>> webservice (the reference), I get the error in the OP.
>>>>> Remove the definitions file and the requires="authentication", and the
>>>>> calls works but gets rejected due to missing the basic authorisation.
>>>>>
>>>>
>>>> Hi Gregor
>>>>
>>>> There's something odd going on here. I set up a test where I deployed
>>>> our calculator service with the AddService deployed as a web service
>>>> to Tomcat with Basic Authentication turned on.
>>>>
>>>> I created a client project where the calculator has a reference to the
>>>> AddService with the "authentication" intent set. This was my
>>>> definitions file.
>>>>
>>>> <definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
>>>> targetNamespace="http://itest/policy"
>>>> xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
>>>> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
>>>> xmlns:ip="http://itest/policy" >
>>>>
>>>>
>>>> <sca:policySet name="BasicAuthenticationPolicySet"
>>>> provides="authentication"
>>>> appliesTo="sca:binding.ws">
>>>> <tuscany:basicAuthentication>
>>>> <tuscany:userName>tuscanyuser</tuscany:userName>
>>>> <tuscany:password>tuscanypwd</tuscany:password>
>>>> </tuscany:basicAuthentication>
>>>> </sca:policySet>
>>>>
>>>>
>>>> </definitions>
>>>>
>>>> I tried it with both a Java implementation and a spring
>>>> implementation. Here's my client component from the composite file...
>>>>
>>>> <component name="CalculatorServiceComponent">
>>>> <!--implementation.java
>>>> class="calculator.CalculatorServiceImpl"/-->
>>>> <implementation.spring
>>>> location="META-INF/spring/CalculatorService-context.xml"/>
>>>> <reference name="addService" >
>>>> <interface.java interface="calculator.AddService" />
>>>> <binding.ws requires="authentication"
>>>> uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
>>>> </reference>
>>>> <reference name="subtractService" target="SubtractServiceComponent"
>>>> />
>>>> <reference name="multiplyService" target="MultiplyServiceComponent"
>>>> />
>>>> <reference name="divideService" target="DivideServiceComponent" />
>>>> </component>
>>>>
>>>> With the password correctly set I get....
>>>>
>>>> 24-May-2010 13:50:29 org.apache.tuscany.sca.node.impl.NodeImpl <init>
>>>> INFO: Creating node: Calculator.composite
>>>> 24-May-2010 13:50:29 org.apache.tuscany.sca.node.impl.NodeImpl
>>>> configureNode
>>>> INFO: Loading contribution:
>>>> file:/D:/sca-java-1.x/samples/calculator/target/classes/
>>>> 24-May-2010 13:50:30 org.apache.tuscany.sca.node.impl.NodeImpl start
>>>> INFO: Starting node: Calculator.composite
>>>> - Loading XML bean definitions from URL
>>>> [file:/D:/sca-java-1.x/samples/calculator/target/classes/META-INF/spring/CalculatorService-context.xml]
>>>> - Module validation failed: The system is attempting to engage a
>>>> module that is not available: rampart
>>>> - Refreshing
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387:
>>>> display name
>>>> [org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387];
>>>> startup date [Mon May 24 13:50:31 BST 2010]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>> - Bean factory for application context
>>>> [org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387]:
>>>> org.springframework.beans.factory.xml.xmlbeanfact...@192d604
>>>> Spring parent context - containsBean called for name: loadTimeWeaver
>>>> - Pre-instantiating singletons in
>>>> org.springframework.beans.factory.xml.xmlbeanfact...@192d604: defining
>>>> beans [CalculatorServiceBean]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>> Spring parent context - getBean called for name: addService
>>>> Spring parent context - getBean called for name: subtractService
>>>> Spring parent context - getBean called for name: multiplyService
>>>> Spring parent context - getBean called for name: divideService
>>>> 3 + 2=5.0
>>>> 3 - 2=1.0
>>>> 3 * 2=6.0
>>>> 3 / 2=1.5
>>>> 24-May-2010 13:50:32 org.apache.tuscany.sca.node.impl.NodeImpl stop
>>>> INFO: Stopping node: Calculator.composite
>>>> - Closing
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387:
>>>> display name
>>>> [org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387];
>>>> startup date [Mon May 24 13:50:31 BST 2010]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>> - Destroying singletons in
>>>> org.springframework.beans.factory.xml.xmlbeanfact...@192d604: defining
>>>> beans [CalculatorServiceBean]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>>
>>>>
>>>> with the password set to "abcdefg" I get...
>>>>
>>>> 24-May-2010 13:45:01 org.apache.tuscany.sca.node.impl.NodeImpl <init>
>>>> INFO: Creating node: Calculator.composite
>>>> 24-May-2010 13:45:01 org.apache.tuscany.sca.node.impl.NodeImpl
>>>> configureNode
>>>> INFO: Loading contribution:
>>>> file:/D:/sca-java-1.x/samples/calculator/target/classes/
>>>> 24-May-2010 13:45:02 org.apache.tuscany.sca.node.impl.NodeImpl start
>>>> INFO: Starting node: Calculator.composite
>>>> - Loading XML bean definitions from URL
>>>> [file:/D:/sca-java-1.x/samples/calculator/target/classes/META-INF/spring/CalculatorService-context.xml]
>>>> - Module validation failed: The system is attempting to engage a
>>>> module that is not available: rampart
>>>> - Refreshing
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387:
>>>> display name
>>>> [org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387];
>>>> startup date [Mon May 24 13:45:03 BST 2010]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>> - Bean factory for application context
>>>> [org.apache.tuscany.sca.implementation.spring.runtime.context.scagenericapplicationcont...@14a9387]:
>>>> org.springframework.beans.factory.xml.xmlbeanfact...@192d604
>>>> Spring parent context - containsBean called for name: loadTimeWeaver
>>>> - Pre-instantiating singletons in
>>>> org.springframework.beans.factory.xml.xmlbeanfact...@192d604: defining
>>>> beans [CalculatorServiceBean]; parent:
>>>> org.apache.tuscany.sca.implementation.spring.runtime.context.scaparentapplicationcont...@18782a7
>>>> Spring parent context - getBean called for name: addService
>>>> Spring parent context - getBean called for name: subtractService
>>>> Spring parent context - getBean called for name: multiplyService
>>>> Spring parent context - getBean called for name: divideService
>>>> - Basic authentication scheme selected
>>>> - Failure authenticating with BASIC 'Application'@localhost:8080
>>>> - Unable to sendViaPost to
>>>> url[http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent]
>>>> org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
>>>>
>>>> So it seems to be basically working so my suspicion is turning to the
>>>> WSDL you have? What style is the WSDL using, by default Tuscany is
>>>> expecting to deal with Doc/Lit/Wrapped. If the external service is
>>>> doing something else we'll have to look at how the WSDL is configured.
>>>>
>>>>
>>>> Regards
>>>>
>>>> Simon
>>>>
>>>> --
>>>> Apache Tuscany committer: tuscany.apache.org
>>>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>>>
>>>>
>>>> The WSDL is huge. Cutting it down to the relevant parts
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>>>> xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
>>>> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>>>> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
>>>> xmlns:tns="http://soa.mycompany.com/webservices/"
>>>> xmlns:s1="http://microsoft.com/wsdl/types/"
>>>> xmlns:s="http://www.w3.org/2001/XMLSchema"
>>>> xmlns:s2="http://soa.mycompany.com/webservices/AbstractTypes"
>>>> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
>>>> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
>>>> targetNamespace="http://soa.mycompany.com/webservices/"
>>>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>>>> <wsdl:types>
>>>> <s:schema elementFormDefault="qualified"
>>>> targetNamespace="http://soa.mycompany.com/webservices/">
>>>> <s:import namespace="http://microsoft.com/wsdl/types/" />
>>>> <s:complexType name="ArrayOfString">
>>>> <s:sequence>
>>>> <s:element minOccurs="0" maxOccurs="unbounded" name="string"
>>>> nillable="true" type="s:string" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> <s:simpleType name="LoginTokenType">
>>>> <s:restriction base="s:string">
>>>> <s:enumeration value="Unknown" />
>>>> <s:enumeration value="SessionSecureToken" />
>>>> <s:enumeration value="SessionHttpToken" />
>>>> <s:enumeration value="PersistentSecureToken" />
>>>> <s:enumeration value="PersistentHttpToken" />
>>>> </s:restriction>
>>>> </s:simpleType>
>>>> <s:complexType name="WebServiceResult">
>>>> <s:sequence>
>>>> <s:element minOccurs="1" maxOccurs="1" name="Success"
>>>> type="s:boolean" />
>>>> <s:element minOccurs="0" maxOccurs="1" name="ResultStatus"
>>>> type="s:string" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> <s:element name="Login">
>>>> <s:complexType>
>>>> <s:sequence>
>>>> <s:element minOccurs="0" maxOccurs="1" name="userName"
>>>> type="s:string" />
>>>> <s:element minOccurs="0" maxOccurs="1" name="password"
>>>> type="s:string" />
>>>> <s:element minOccurs="0" maxOccurs="1" name="existingTokenIds"
>>>> type="tns:ArrayOfString" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> </s:element>
>>>> <s:element name="LoginResponse">
>>>> <s:complexType>
>>>> <s:sequence>
>>>> <s:element minOccurs="0" maxOccurs="1" name="LoginResult"
>>>> type="tns:LoginResult" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> </s:element>
>>>> <s:complexType name="LoginResult">
>>>> <s:complexContent mixed="false">
>>>> <s:extension base="tns:WebServiceResult">
>>>> <s:sequence>
>>>> <s:element minOccurs="1" maxOccurs="1" name="UserID"
>>>> type="s1:guid" />
>>>> <s:element minOccurs="0" maxOccurs="1" name="LoginTokens"
>>>> type="tns:ArrayOfLoginToken" />
>>>> <s:element minOccurs="1" maxOccurs="1" name="IsNewSplitUser"
>>>> type="s:boolean" />
>>>> <s:element minOccurs="0" maxOccurs="1"
>>>> name="UserPropertyViolations" type="tns:ArrayOfString" />
>>>> </s:sequence>
>>>> </s:extension>
>>>> </s:complexContent>
>>>> </s:complexType>
>>>> <s:complexType name="ArrayOfLoginToken">
>>>> <s:sequence>
>>>> <s:element minOccurs="0" maxOccurs="unbounded" name="LoginToken"
>>>> nillable="true" type="tns:LoginToken" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> <s:complexType name="LoginToken">
>>>> <s:sequence>
>>>> <s:element minOccurs="1" maxOccurs="1" name="TokenID"
>>>> type="s1:guid" />
>>>> <s:element minOccurs="1" maxOccurs="1" name="Type"
>>>> type="tns:LoginTokenType" />
>>>> <s:element minOccurs="1" maxOccurs="1" name="ExpirationDateUTC"
>>>> type="s:dateTime" />
>>>> </s:sequence>
>>>> </s:complexType>
>>>> <s:element name="LoginResult" nillable="true" type="tns:LoginResult"
>>>> />
>>>> <s:element name="LogoutResult" nillable="true"
>>>> type="tns:LogoutResult" />
>>>> <s:element name="string" nillable="true" type="s:string" />
>>>> </s:schema>
>>>> <s:schema elementFormDefault="qualified"
>>>> targetNamespace="http://microsoft.com/wsdl/types/">
>>>> <s:simpleType name="guid">
>>>> <s:restriction base="s:string">
>>>> <s:pattern
>>>> value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
>>>> />
>>>> </s:restriction>
>>>> </s:simpleType>
>>>> </s:schema>
>>>> <s:schema
>>>> targetNamespace="http://soa.mycompany.com/webservices/AbstractTypes">
>>>> <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>>>> <s:complexType name="StringArray">
>>>> <s:complexContent mixed="false">
>>>> <s:restriction base="soapenc:Array">
>>>> <s:sequence>
>>>> <s:element minOccurs="0" maxOccurs="unbounded" name="String"
>>>> type="s:string" />
>>>> </s:sequence>
>>>> </s:restriction>
>>>> </s:complexContent>
>>>> </s:complexType>
>>>> </s:schema>
>>>> </wsdl:types>
>>>> <wsdl:message name="LoginSoapIn">
>>>> <wsdl:part name="parameters" element="tns:Login" />
>>>> </wsdl:message>
>>>> <wsdl:message name="LoginSoapOut">
>>>> <wsdl:part name="parameters" element="tns:LoginResponse" />
>>>> </wsdl:message>
>>>> <wsdl:portType name="MyModuleServiceSoap">
>>>> <wsdl:operation name="Login">
>>>> <wsdl:input message="tns:LoginSoapIn" />
>>>> <wsdl:output message="tns:LoginSoapOut" />
>>>> </wsdl:operation>
>>>> </wsdl:portType>
>>>> <wsdl:binding name="MyModuleServiceSoap" type="tns:MyModuleServiceSoap">
>>>> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
>>>> <wsdl:operation name="Login">
>>>> <soap:operation
>>>> soapAction="http://soa.mycompany.com/webservices/Login" style="document" />
>>>> <wsdl:input>
>>>> <soap:body use="literal" />
>>>> </wsdl:input>
>>>> <wsdl:output>
>>>> <soap:body use="literal" />
>>>> </wsdl:output>
>>>> </wsdl:operation>
>>>> </wsdl:binding>
>>>> <wsdl:service name="MyModuleService">
>>>> <wsdl:port name="MyModuleServiceSoap" binding="tns:MyModuleServiceSoap">
>>>> <soap:address
>>>> location="http://soa.0002.dev.mycompany.com/MyModuleFacility/MyModuleService.asmx"
>>>> />
>>>> </wsdl:port>
>>>> </wsdl:service>
>>>> </wsdl:definitions>
>>>>
>>>
>>> On the face of it that looks OK. Can you tell if the IOOB was on the
>>> request or the response? Do you still have the full stack trace?
>>>
>>> Simon
>>>
>>> --
>>> Apache Tuscany committer: tuscany.apache.org
>>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>>
>>> It was on the request. Full stack below. Version 1.6 Remember, I noted that
>>> the OMElementWrapperHandler class changed in 2.
>>>
>>> org.apache.axis2.AxisFault: 1
>>> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>>> at
>>> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver.invokeBusinessLogic(Axis2ServiceInOutSyncMessageReceiver.java:94)
>>> at
>>> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
>>> at
>>> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
>>> at
>>> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>>> at
>>> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>> at
>>> org.apache.tuscany.sca.host.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:107)
>>> at
>>> org.apache.tuscany.sca.host.webapp.TuscanyServletFilter.doFilter(TuscanyServletFilter.java:94)
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>> at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>> at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>> at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>> at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>> at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>> at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>> at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>> at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
>>> at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>>> at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>>> at java.lang.Thread.run(Unknown Source)
>>> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>>> at
>>> org.apache.tuscany.sca.databinding.axiom.OMElementWrapperHandler.setChildren(OMElementWrapperHandler.java:76)
>>> at
>>> org.apache.tuscany.sca.databinding.axiom.OMElementWrapperHandler.setChildren(OMElementWrapperHandler.java:48)
>>> at
>>> org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:206)
>>> at
>>> org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:45)
>>> at
>>> org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:113)
>>> at
>>> org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediateInput(MediatorImpl.java:431)
>>> at
>>> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:65)
>>> at
>>> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
>>> at
>>> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
>>> at $Proxy24.Login(Unknown Source)
>>> at
>>> com.mycompany.myproduct.authentication.impl.DefaultImplementation.doFoo(DefaultImplementation.java:22)
>>> 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
>>> org.apache.tuscany.sca.implementation.spring.invocation.SpringInvoker.doInvoke(SpringInvoker.java:97)
>>> at
>>> org.apache.tuscany.sca.implementation.spring.invocation.SpringInvoker.invoke(SpringInvoker.java:113)
>>> at
>>> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:67)
>>> at
>>> org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationServicePolicyInterceptor.invoke(BasicAuthenticationServicePolicyInterceptor.java:82)
>>> at
>>> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:129)
>>> at
>>> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:104)
>>> at
>>> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:98)
>>> at
>>> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:173)
>>> at
>>> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider.invokeTarget(Axis2ServiceProvider.java:766)
>>> at
>>> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver.invokeBusinessLogic(Axis2ServiceInOutSyncMessageReceiver.java:70)
>>>
>>
>> Ok, so it is getting through basic authentication and, as you say,
>> failing on the transformation going out to the external service. If
>> you take out the definitions.xml file then it will fail on the basic
>> authentication and won't get as far as calling the external service
>> hence no IOOB in that case.
>>
>> How did you generate the interface that contains the Login operation
>> from the WSDL? I'll see if I can mock it up here as see if I can see
>> what's going wrong with the wrapping.
>>
>> Simon
>>
>> --
>> Apache Tuscany committer: tuscany.apache.org
>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>
>> Did a straightforward wsdl2java from Axis 2 on the WSDL using the below
>> command line, then included the generated source in the project, and hooked
>> it up.
>>
>> C:\axis2-1.5.1\bin>wsdl2java -o c:\temp\wsdl2java -ss -ssi -uri
>> c:\temp\wsdl2java\MyService.wsdl
>>
>
> Hi Gregor
>
> I ran the same command on the WSDL and set up a small test using the
> generated Java. I had to manually
>
> - add @Remotable to the generated MyModuleServiceSkeletonInterface
> interface as I'm using it with binding.ws
> - add a default constructor to LoginTokenType as the JAX-WS WSDL gen
> that we use inside Tuscany expects it to have one
>
> I created a very simple test based on our calculator sample.
>
> Composite (I added testRef)
> ====================
>
> <component name="CalculatorServiceComponent">
> <implementation.java class="calculator.CalculatorServiceImpl"/>
> <!--implementation.spring
> location="META-INF/spring/CalculatorService-context.xml"/-->
> <reference name="testRef">
> <binding.ws
> uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
> </reference>
> <reference name="addService" >
> <interface.java interface="calculator.AddService" />
> <binding.ws requires="authentication"
> uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
> </reference>
> <reference name="subtractService" target="SubtractServiceComponent" />
> <reference name="multiplyService" target="MultiplyServiceComponent" />
> <reference name="divideService" target="DivideServiceComponent" />
> </component>
>
> Implementation ( I extended the calculator's add method)
> =========================================
>
> public double add(double n1, double n2) {
>
> ArrayOfString existingTokens = new ArrayOfString();
> existingTokens.addString("XYZ");
> existingTokens.addString("ABC");
>
> Login login = new Login();
> login.setUserName("SomeUser");
> login.setPassword("SomePassword");
> login.setExistingTokenIds(existingTokens);
>
> testRef.login(login);
>
> return addService.add(n1, n2);
> }
>
> Result
> =====
>
> The web services binding generates the following message on the wire
>
>
> POST /sample-calculator-ws-webapp/AddServiceComponent HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: ""
> User-Agent: Axis2
> Host: localhost:8080
> Content-Length: 387
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns2:login xmlns:ns2="http://webservices.soa.mycompany.com/">
> <arg0>
> <existingTokenIds>
> <string>XYZ</string>
> <string>ABC</string>
> </existingTokenIds>
> <password>SomePassword</password>
> <userName>SomeUser</userName>
> </arg0>
> </ns2:login>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Where <arg0> represents the login object that's passed in.
>
> To take a step closer to your composite I changed mine to configure
> the web service binding with the WSDL directly.
>
> Composite (I just changed the reference)
> =============================
>
> <reference name="testRef">
> <binding.ws
> wsdlElement="http://soa.mycompany.com/webservices/#wsdl.port(MyModuleService/MyModuleServiceSoap)"/>
> </reference>
>
> Result
> =====
>
> I had to mess about fixing the name of the Axis generated interface
> (to MyModuleServiceSOAP.java) as JAX-WS has some expectations. Also
> the name of the operation in the WSDL was "Login" and Axis generated
> an operation called "login". Tuscany picks up on this incompatibility
> and complains so I went back and fixed the WSDL for simplicity
> although in reality I should have fixed the generated Java.
>
> Again a message appeared on the wire
>
> POST /MyModuleFacility/MyModuleService.asmx HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: "http://soa.mycompany.com/webservices/Login"
> User-Agent: Axis2
> Host: localhost:8080
> Content-Length: 495
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns3:Login xmlns:ns2="http://webservices.soa.mycompany.com/"
> xmlns:ns3="http://soa.mycompany.com/webservices/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="login">
> <existingTokenIds>
> <string>XYZ</string>
> <string>ABC</string>
> </existingTokenIds>
> <password>SomePassword</password>
> <userName>SomeUser</userName>
> </ns3:Login>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Note no <arg0> this time. Seems to be document literal but not
> wrapped. Also the xsi:type looks wrong. Not sure why this is
> happening.
>
> Next I added the authentication intent to the reference.
>
> Composite (I just changed the reference)
> =============================
>
> <reference name="testRef">
> <binding.ws
> wsdlElement="http://soa.mycompany.com/webservices/#wsdl.port(MyModuleService/MyModuleServiceSoap)"
> requires="authentication"/>
> </reference>
>
> Result
> =====
>
> Again a message in the wire
>
> POST /MyModuleFacility/MyModuleService.asmx HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: "http://soa.mycompany.com/webservices/Login"
> User-Agent: Axis2
> Authorization: Basic dHVzY2FueXVzZXI6dHVzY2FueXB3ZA==
> Host: localhost:8080
> Content-Length: 495
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns3:Login xmlns:ns3="http://soa.mycompany.com/webservices/"
> xmlns:ns2="http://webservices.soa.mycompany.com/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="login">
> <existingTokenIds>
> <string>XYZ</string>
> <string>ABC</string>
> </existingTokenIds>
> <password>SomePassword</password>
> <userName>SomeUser</userName>
> </ns3:Login>
> </soapenv:Body>
> </soapenv:Envelope>
>
> So the same as the previous case but with the "Authorization:" header
> obviously.
>
> The long and short of it is that I'm not sure why I'm not seeing the
> error you're seeing (I am running on the trunk code rather than the
> 1.6 release) however the difference in results when the WSDL is
> attached compared to when the no WSDL is attached to the binding is
> problematic. Can you re-run the test without the "wsdlElement"
> attribute on binding.ws and see what happens.
>
> Thanks
>
> Simon
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>
> You've followed all the steps I did (though I changed the Java rather than
> the WSDL ;) )
>
> Taking the wsdlElement off the binding gives me the following error with both
> the true WSDL and the chopped down (but not anonymised) one.
>
> org.apache.axis2.AxisFault: The system cannot infer the transport information
> from the / URL.
> at
> org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:82)
> at
> org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:302)
> at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:179)
> at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> at
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker$1.run(Axis2BindingInvoker.java:172)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:170)
> at
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:124)
> at
> org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationReferencePolicyInterceptor.invoke(BasicAuthenticationReferencePolicyInterceptor.java:85)
> at
> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:67)
>
Did you add the uri of the t to the binding? For example,
<reference name="testRef">
<binding.ws
uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
</reference>
Simon
--
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com