[ https://issues.apache.org/jira/browse/TUSCANY-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Raymond Feng reassigned TUSCANY-1432: ------------------------------------- Assignee: Raymond Feng > Unable to implement helloworld-ws-reference sample with complex types. > ---------------------------------------------------------------------- > > Key: TUSCANY-1432 > URL: https://issues.apache.org/jira/browse/TUSCANY-1432 > Project: Tuscany > Issue Type: Bug > Components: Java SCA Samples > Affects Versions: Java-SCA-M2 > Environment: Windows XP, JDK 1.5.0_11-b03, ant 1.7.0 > Reporter: David Haney > Assignee: Raymond Feng > Attachments: helloworld-ws-reference.zip > > > I'm attempting to modify the helloworld-ws-reference example so that it is > sending a complexType instead of simple types, and am having trouble with an > exception that I can't explain. I wasn't able to find an example of this > sort of thing in one of the other samples, so I've been trying to piece > together the necessary changes, and I'm guessing I've just missed a step > along the way. > Here's what I've done so far (all file references are relative to > <installdir>/samples/helloworld-ws-reference): > - Modified the src/main/resources/wsdl/helloworld.wsdl So that the > getGreetings operation contains a complexType: > ... > <element name="getGreetings"> > <complexType> > <sequence> > <element name="name" type="tns:Name"/> > </sequence> > </complexType> > </element> > ... > <complexType name="Name"> > <sequence> > <element name="first" type="xsd:string"/> > <element name="last" type="xsd:string"/> > </sequence> > </complexType> > ... > - Next, I code-generated the static SDO types based on the updated WSDL file. > I added the following to the root build.xml in order to generate the types > (I wasn't able to find the necessary code-generator tools in the SCA > distribution, so the following depends on an external SDO distribution > specified by the environment variable TUSCANY_SDO. I used the > tuscany-sdo-1.0-incubating-beta1 binary distribution for this test): > ... > <property environment="env"/> > <target name="codegen" depends="init"> > <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" > fork="true"> > <classpath> > <pathelement > path="${env.TUSCANY_SDO}/lib/tuscany-sdo-tools-1.0-incubating-beta1.jar" > /> > <pathelement path="${env.TUSCANY_SDO}/lib/common-2.2.2.jar"/> > <pathelement path="${env.TUSCANY_SDO}/lib/ecore-2.2.2.jar"/> > <pathelement > path="${env.TUSCANY_SDO}/lib/sdo-api-r2.1-1.0-incubating-beta1.jar"/> > <pathelement > path="${env.TUSCANY_SDO}/lib/tuscany-sdo-impl-1.0-incubating-beta1.jar"/ > > > <pathelement path="${env.TUSCANY_SDO}/lib/ecore-xmi-2.2.2.jar"/> > <pathelement path="${env.TUSCANY_SDO}/lib/xsd-2.2.2.jar"/> > <pathelement > path="${env.TUSCANY_SDO}/lib/ecore-change-2.2.2.jar"/> > <pathelement path="${env.TUSCANY_SDO}/lib/codegen-2.2.2.jar"/> > <pathelement > path="${env.TUSCANY_SDO}/lib/codegen-ecore-2.2.2.jar"/> > </classpath> > <arg value="-targetDirectory"/> > <arg value="src/main/java"/> > <arg value="-javapackage"/> > <arg value="helloworld"/> > <arg value="src/main/resources/wsdl/helloworld.wsdl"/> > </java> > </target> > ... > - This produced the following files in src/main/java/helloworld: > getGreetings.java > getGreetingsResponse.java > HelloworldFactory.java > Name.java > impl/getGreetingsImpl.java > impl/getGreetingsResponseImpl.java > impl/HelloworldFactoryImpl.java > impl/NameImpl.java > - Once these were in place, I modified HelloWorldService::getGreetings() to > take the new Name type: > ... > public interface HelloWorldService { > public String getGreetings(Name name); } > - and modified HelloWorldServiceComponent::getGreeting() to match: > ... > public String getGreetings(Name name) { > System.out.println("Called getGreetings"); > return helloWorldService.getGreetings(name); > } > - Finally, I modified HelloWorldServiceClient::main() to create a Name > instance, and pass it into the getGreetings() call. > ... > Name name = HelloworldFactory.INSTANCE.createName(); > name.setFirst("David"); > name.setLast("Haney"); > String value = helloWorldService.getGreetings(name); > ... > - Once all of the code changes were in place, I went back to the > src/main/resources/helloworldws.composite file, and attempted to update it so > that it would recognize that it should be using the SDO binding: > <dbsdo:import.sdo > xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" > factory="helloworld.HelloworldFactory"/> > - That seemed like it should be sufficient based on the > documentation/tests/demos/examples that I was able to find, however when I > attempt to run the application, I'm seeing the following output: > Buildfile: build.xml > run: > [java] log4j:WARN No appenders could be found for logger > (org.apache.axiom.om.util.StAXUtils). > [java] log4j:WARN Please initialize the log4j system properly. > [java] Injected helloWorldService > [java] Called getGreetings > [java] Exception in thread "main" org.apache.axiom.om.OMException: > java.util.NoSuchElementException: End of stream has reached. > [java] at > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:2 > 11) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java > :546) > [java] at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedEl > ementImpl.java:744) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImp > l.java:557) > [java] at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSou > rcedElementImpl.java:736) > [java] at > org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav > a:138) > [java] at > org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav > a:110) > [java] at > org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:93) > [java] at > org.apache.axiom.om.impl.llom.OMStAXWrapper.<init>(OMStAXWrapper.java:17 > 1) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReader(OMElement > Impl.java:649) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReaderWithoutCac > hing(OMElementImpl.java:628) > [java] at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getXMLStreamReaderWit > houtCaching(OMSourcedElementImpl.java:386) > [java] at > org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS > erializerUtil.java:488) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementI > mpl.java:783) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume( > OMElementImpl.java:808) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementI > mpl.java:779) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume( > OMElementImpl.java:808) > [java] at > org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOA > PEnvelopeImpl.java:234) > [java] at > org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE > nvelopeImpl.java:222) > [java] at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume( > OMElementImpl.java:808) > [java] at > org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl. > java:418) > [java] at > org.apache.axis2.transport.http.SOAPMessageFormatter.getBytes(SOAPMessag > eFormatter.java:77) > [java] at > org.apache.axis2.transport.http.AxisRequestEntity.getContentLength(AxisR > equestEntity.java:109) > [java] at > org.apache.commons.httpclient.methods.EntityEnclosingMethod.getRequestCo > ntentLength(EntityEnclosingMethod.java:332) > [java] at > org.apache.commons.httpclient.methods.EntityEnclosingMethod.addContentLe > ngthRequestHeader(EntityEnclosingMethod.java:402) > [java] at > org.apache.commons.httpclient.methods.EntityEnclosingMethod.addRequestHe > aders(EntityEnclosingMethod.java:370) > [java] at > org.apache.commons.httpclient.HttpMethodBase.writeRequestHeaders(HttpMet > hodBase.java:2036) > [java] at > org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase > .java:1919) > [java] at > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java > :993) > [java] at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe > thodDirector.java:397) > [java] at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho > dDirector.java:170) > [java] at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 > 96) > [java] at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 > 46) > [java] at > org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abstrac > tHTTPSender.java:558) > [java] at > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:1 > 76) > [java] at > org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73) > [java] at > org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageW > ithCommons(CommonsHTTPTransportSender.java:305) > [java] at > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common > sHTTPTransportSender.java:201) > [java] at > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452) > [java] at > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper > ation.java:330) > [java] at > org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO > peration.java:294) > [java] at > org.apache.tuscany.sca.binding.axis2.Axis2BindingInvoker.invokeTarget(Ax > is2BindingInvoker.java:92) > [java] at > org.apache.tuscany.sca.binding.axis2.Axis2BindingInvoker.invoke(Axis2Bin > dingInvoker.java:71) > [java] at > org.apache.tuscany.core.databinding.wire.DataTransformationInteceptor.in > voke(DataTransformationInteceptor.java:68) > [java] at > org.apache.tuscany.sca.core.invocation.AbstractInvocationHandler.invoke( > AbstractInvocationHandler.java:84) > [java] at > org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKIn > vocationHandler.java:73) > [java] at $Proxy5.getGreetings(Unknown Source) > [java] at > helloworld.HelloWorldServiceComponent.getGreetings(HelloWorldServiceComp > onent.java:30) > [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > [java] at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > a:39) > [java] at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > Impl.java:25) > [java] at java.lang.reflect.Method.invoke(Method.java:585) > [java] at > org.apache.tuscany.sca.implementation.java.invocation.JavaTargetInvoker. > invokeTarget(JavaTargetInvoker.java:112) > [java] at > org.apache.tuscany.sca.implementation.java.invocation.JavaTargetInvoker. > invoke(JavaTargetInvoker.java:134) > [java] at > org.apache.tuscany.sca.implementation.java.invocation.PassByValueInvoker > .invoke(PassByValueInvoker.java:61) > [java] at > org.apache.tuscany.sca.implementation.java.invocation.TargetInvokerInvok > er.invoke(TargetInvokerInvoker.java:46) > [java] at > org.apache.tuscany.sca.core.invocation.AbstractInvocationHandler.invoke( > AbstractInvocationHandler.java:84) > [java] at > org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKIn > vocationHandler.java:73) > [java] at $Proxy5.getGreetings(Unknown Source) > [java] at > helloworld.HelloWorldClient.main(HelloWorldClient.java:42) > [java] Caused by: java.util.NoSuchElementException: End of stream has > reached. > [java] at > org.apache.tuscany.sdo.util.resource.XMLDocumentStreamReader.next(XMLDoc > umentStreamReader.java:88) > [java] at > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1 > 25) > [java] ... 59 more > BUILD SUCCESSFUL > Total time: 2 seconds > I've attempted this on Windows using the tuscany-sca-0.90-incubating binary > distribution, as well as RC3 for the tuscany-sca-0.91-incubating > distribution, and am seeing the same exception from both. The example is > sending the data through a tcptunnel (so that I can see the on-the-wire > format), and it appears this is failing while generating the message, since > I'm not seeing any traffic on the wire. -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]