Janet, If the element is defined as a string, then Axis will map the return message to a string, and then your application will need to parse the XML programmatically. Axis will not be able to map the string to objects for you.
This approach works, but it's not a good practice. Essentially, the XML repsonse is treated like an opaque string, and you can't rely on your middleware to do things like validation or automatic XML-to-object mapping. If you have any influence at all on the design of the other company's service, you should encourage them to send the XML as XML (in which the schema of the message is defined in the WSDL) and not as an opaque string. I would hope that this other company provides the schema of the XML string to you separately. In that case, you could use something like Castor or JAXB within your application to map the returned string into objects. But that function would have to be performed by your application code, and not by Axis. Regards, Anne On 7/8/05, Rajesh Nair <[EMAIL PROTECTED]> wrote: > I would be surprised if there is something like that. How is WSDL2Java > in Axis gonna know how to map your xml to your java objects, since it > wont have any information about your schema. I would suggest look for > another open source tool called XMLBeans also from Apache to do the > mapping. Hope that helps a bit. > > -Rajesh > > -----Original Message----- > From: Miller, Janet [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 5:37 PM > To: [email protected] > Subject: RE: Passing an xml string as a parameter > > Yes, that's exactly what I thought and I did already go through the Axis > user guide and read that section. I was proceeding to write the code to > parse the xml String myself, but someone posted something that indicated > that Axis would do the parsing for you and generate the appropriate > class. > > If anyone knows more about this, please let us know. > > Thanks, Jan > > -----Original Message----- > From: Rajesh Nair [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 5:33 PM > To: [email protected] > Subject: RE: Passing an xml string as a parameter > > > I think there's some confusion here. I think the classes created by > WSDL2Java are correct and doesn't generate any of the binding classes > because the parameter to the method and return value are > java.lang.String objects. The java.lang.String objects are by default > mapped to the corresponding SOAP/XML types in Axis, which is in > accordance to the JAX-RPC specification. > U can also go through - > > http://ws.apache.org/axis/java/user-guide.html#ServiceStylesRPCDocumentW > rappedAndMessage > > > for more information on service styles and > > http://ws.apache.org/axis/java/user-guide.html#XMLJavaDataMappingInAxis > > for Java Data Mapping in Axis. > > Hope that helps. > > -Rajesh > > -----Original Message----- > From: Miller, Janet [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 5:22 PM > To: [email protected] > Subject: RE: Passing an xml string as a parameter > > Yes, my return value is of type java.lang.String and the original wsdl > indicates document/literal. Jeff, in an earlier post indicated that Axis > is able to generate and parse the XML for you. Are you sure I have to > parse myself? > > Jan > > -----Original Message----- > From: Rajesh Nair [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 5:20 PM > To: [email protected] > Subject: RE: Passing an xml string as a parameter > > > Hi Janet, > If I am not wrong you are getting an xml string. That is u are > getting a return value of type java.lang.String. Correct me if I am > wrong here. If this is the case, then U will have to parse that string > and accordingly generate your objects. > > -Rajesh > > -----Original Message----- > From: Miller, Janet [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 5:16 PM > To: [email protected] > Subject: RE: Passing an xml string as a parameter > > I've already used wsdl2java to create a web service from a remote wsdl > file that I've received. My web service is working and I have a client > that is succesfully accessing it and retrieving data. But how would > wsdl2java know my schema definition? It didn't generate a class that > represents the data model. It just generated 6 java files: TZCService, > TZCServiceLocator, TZCServiceSoap, TZCServiceSoapImpl, > TZCServiceSoapSkeleton, and TZCServiceSoapStub. There is nothing that > contains the xml return document elements. Do I need to put an xsd file > somewhere? In my xml namespace or target namespace? > > If someone could provide some step-by-step process on how to do this, I > would GREATLY appreciate it. > > Jan > > -----Original Message----- > From: Jeff [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 3:33 AM > To: [email protected] > Subject: Re: Passing an xml string as a parameter > > > Don't feel foolish, we are not born knowing this stuff! > > Start with a WSDL document then the WSDL2Java tool (part of Axis) can be > used to generate a data model in the form of classes with persistence > methods (serialization/deserialization). Consequently, Axis is able to > generate and parse the XML for you. Alternatively or additionally, if > you like, you can handle the SOAP payload as a document. Documents have > the advantage of being something more tangible than mere parameters. > Originators can sign documents, for instance. Documents can be stored in > a variety of places, e.g. a search engine or a database. > > > Jeff > > > ----- Original Message ----- > From: "Miller, Janet" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Friday, July 08, 2005 2:52 PM > Subject: RE: Passing an xml string as a parameter > > > Yup, I'm a newbie and feel foolish now, but I need to ask some more > questions about this. I've looked at the Axis user guide and some other > sites and I'm still confused about how to map the returned xml document > to a Java object. How do you do this? Will Axis do this automatically > for me or do I have to parse the returned xml string myself? > > Thanks for your help, > Jan > > -----Original Message----- > From: Jeff [mailto:[EMAIL PROTECTED] > Sent: Friday, July 08, 2005 2:17 AM > To: [email protected] > Subject: Re: Passing an xml string as a parameter > > > Find out about document-literal, Jan. > > > > ----- Original Message ----- > From: "Miller, Janet" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Friday, July 08, 2005 2:14 PM > Subject: Passing an xml string as a parameter > > > I was just wondering if anyone had any thoughts on this. I am going to > access another company's web service and the input parameter to the web > service is an xml string that represents a query request for data. The > response that I get back is also an xml string. So, instead of passing > multiple parameters, we are just passing on xml string parameter. So I > guess the soap packet would be xml within xml which seems kind of odd. > > I guess it will probably work, but is this an ok way to do things? Just > curious about people's thoughts on something like this. > > Thanks, > > Jan > >
