RE: Exception parsing complex data type
Got it to work...seems that the deploy.wsdd file created by Eclipse/WST didn't set style attribute to wrapped. When I set it manually, all is well. Please note the last wsdl I provided didn't have the style set to wrapped, but it was with the copy I was using. Sorry for the confusion Ann, thanks for all your help Karl -Original Message- From: Schwarz, Karl [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 19, 2005 7:53 AM To: axis-user@ws.apache.org Subject: RE: Exception parsing complex data type Well I've tried a few different tracks and I am still left with the same original problem, that is an org.xml.sax.SAXException: Invalid element exception The wsdl I am using is a follows: wsdl:definitions name=PhotoCatalogService targetNamespace=http://examples.com/PhotoCatalog; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:types=http://examples.com/PhotoCatalog/types; xmlns:mime=http://schemas.xmlsoap.org/wsdl/mime/; xmlns:tns=http://examples.com/PhotoCatalog; wsdl:types xsd:schema targetNamespace=http://examples.com/PhotoCatalog/types; xmlns:types=http://examples.com/PhotoCatalog/types; !-- Wrapper elements to provide unique signatures for the addPhoto and replacePhoto operations -- xsd:element name=addPhoto xsd:complexType xsd:sequence xsd:element ref=types:PhotoInfo/ /xsd:sequence /xsd:complexType /xsd:element xsd:element name=replacePhoto xsd:complexType xsd:sequence xsd:element ref=types:PhotoInfo/ /xsd:sequence /xsd:complexType /xsd:element !-- Output for the addPhoto and replacePhoto operations. -- xsd:element name=status type=xsd:string / !-- Input for the addPhoto and replacePhoto operations. -- xsd:element name=PhotoInfo xsd:complexType xsd:sequence xsd:element name=customerName type=xsd:string/ xsd:element name=photoID type=xsd:int/ !--xsd:element name=photoRef type=wsi:swaRef/-- /xsd:sequence /xsd:complexType /xsd:element /xsd:schema /wsdl:types wsdl:message name=addPhotoRequest !-- first part is the SOAP body -- wsdl:part name=body element=types:addPhoto/ !-- second part is the attachment -- wsdl:part name=photo type=xsd:base64Binary/ /wsdl:message wsdl:message name=addPhotoResponse wsdl:part name=body element=types:status/ /wsdl:message wsdl:message name=replacePhotoRequest wsdl:part name=body element=types:replacePhoto/ wsdl:part name=newPhoto type=xsd:base64Binary/ /wsdl:message wsdl:message name=replacePhotoResponse wsdl:part name=status element=types:status/ /wsdl:message wsdl:portType name=PhotoCatalog wsdl:operation name=addPhoto wsdl:input message=tns:addPhotoRequest/ wsdl:output message=tns:addPhotoResponse/ /wsdl:operation wsdl:operation name=replacePhoto wsdl:input message=tns:replacePhotoRequest/ wsdl:output message=tns:replacePhotoResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=PhotoCatalogBinding type=tns:PhotoCatalog soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=addPhoto soap:operation soapAction=addPhoto/ wsdl:input mime:multipartRelated mime:part soap:body parts=body use=literal/ /mime:part mime:part mime:content part=photo type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output soap:body use=literal/ /wsdl:output /wsdl:operation wsdl:operation name=replacePhoto soap:operation soapAction=replacePhoto/ wsdl:input mime:multipartRelated mime:part soap:body parts=body use=literal/ /mime:part mime:part mime:content part=newPhoto type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output soap:body use=literal/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=PhotoCatalogService wsdl:port name=PhotoCatalogPort binding=tns:PhotoCatalogBinding soap:address location=http://192.168.1.100:8080/axis/services/PhotoCatalogPort/ /wsdl:port /wsdl:service /wsdl:definitions I removed the use of swaRef in accordance with 3.1.4.1 of WS-I Usage Scenarios for the WS-I Attachments Profile 1.0 (version 1.02 http://www.ws-i.org/SampleApplications/UsageScenariosAP-1.02-MRD.pdf) Has anyone successfully processed a SOAP with Attachments request using AXIS 1-2RC3 and a wsdl like the one I have included. Karl
RE: Exception parsing complex data type
Well I've tried a few different tracks and I am still left with the same original problem, that is an org.xml.sax.SAXException: Invalid element exception The wsdl I am using is a follows: wsdl:definitions name=PhotoCatalogService targetNamespace=http://examples.com/PhotoCatalog; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:types=http://examples.com/PhotoCatalog/types; xmlns:mime=http://schemas.xmlsoap.org/wsdl/mime/; xmlns:tns=http://examples.com/PhotoCatalog; wsdl:types xsd:schema targetNamespace=http://examples.com/PhotoCatalog/types; xmlns:types=http://examples.com/PhotoCatalog/types; !-- Wrapper elements to provide unique signatures for the addPhoto and replacePhoto operations -- xsd:element name=addPhoto xsd:complexType xsd:sequence xsd:element ref=types:PhotoInfo/ /xsd:sequence /xsd:complexType /xsd:element xsd:element name=replacePhoto xsd:complexType xsd:sequence xsd:element ref=types:PhotoInfo/ /xsd:sequence /xsd:complexType /xsd:element !-- Output for the addPhoto and replacePhoto operations. -- xsd:element name=status type=xsd:string / !-- Input for the addPhoto and replacePhoto operations. -- xsd:element name=PhotoInfo xsd:complexType xsd:sequence xsd:element name=customerName type=xsd:string/ xsd:element name=photoID type=xsd:int/ !--xsd:element name=photoRef type=wsi:swaRef/-- /xsd:sequence /xsd:complexType /xsd:element /xsd:schema /wsdl:types wsdl:message name=addPhotoRequest !-- first part is the SOAP body -- wsdl:part name=body element=types:addPhoto/ !-- second part is the attachment -- wsdl:part name=photo type=xsd:base64Binary/ /wsdl:message wsdl:message name=addPhotoResponse wsdl:part name=body element=types:status/ /wsdl:message wsdl:message name=replacePhotoRequest wsdl:part name=body element=types:replacePhoto/ wsdl:part name=newPhoto type=xsd:base64Binary/ /wsdl:message wsdl:message name=replacePhotoResponse wsdl:part name=status element=types:status/ /wsdl:message wsdl:portType name=PhotoCatalog wsdl:operation name=addPhoto wsdl:input message=tns:addPhotoRequest/ wsdl:output message=tns:addPhotoResponse/ /wsdl:operation wsdl:operation name=replacePhoto wsdl:input message=tns:replacePhotoRequest/ wsdl:output message=tns:replacePhotoResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=PhotoCatalogBinding type=tns:PhotoCatalog soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=addPhoto soap:operation soapAction=addPhoto/ wsdl:input mime:multipartRelated mime:part soap:body parts=body use=literal/ /mime:part mime:part mime:content part=photo type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output soap:body use=literal/ /wsdl:output /wsdl:operation wsdl:operation name=replacePhoto soap:operation soapAction=replacePhoto/ wsdl:input mime:multipartRelated mime:part soap:body parts=body use=literal/ /mime:part mime:part mime:content part=newPhoto type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output soap:body use=literal/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=PhotoCatalogService wsdl:port name=PhotoCatalogPort binding=tns:PhotoCatalogBinding soap:address location=http://192.168.1.100:8080/axis/services/PhotoCatalogPort/ /wsdl:port /wsdl:service /wsdl:definitions I removed the use of swaRef in accordance with 3.1.4.1 of WS-I Usage Scenarios for the WS-I Attachments Profile 1.0 (version 1.02 http://www.ws-i.org/SampleApplications/UsageScenariosAP-1.02-MRD.pdf) Has anyone successfully processed a SOAP with Attachments request using AXIS 1-2RC3 and a wsdl like the one I have included. Karl
RE: Exception parsing complex data type
Anne, I got past the Non nillable element 'photoRef' is null exception by placing a dummy URI into the PhotoInfo object, probably not the right approach but I wanted to get to the point where I can actually send the SOAP request to the updated service. I've rebuilt the service with the new wsdl you suggested. Unfortunately I am getting the same Invalid element exception as originally reported. The SOAP package sent from client to server looks as before (with the exception of the additional photoRef element. I am not sure that I am approaching this correctly. Can I use the wsdl approach with the latest release of AXIS to define a service that processing a SOAP with attachment message? Or am I too early in the AXIS development cycle? The samples included in the AXIS release don't seem to be using a wsdl at all. What is the recommended approach, given the current state of AXIS? regards, Karl -Original Message- From: Schwarz, Karl [mailto:[EMAIL PROTECTED] Sent: Monday, April 18, 2005 7:31 AM To: axis-user@ws.apache.org; Anne Thomas Manes Subject: RE: Exception parsing complex data type Anne, Thanks for the help. I still have a few questions 1. I am sure that I would have never come up with the idea to define wrapper elements for addPhoto and replacePhoto operations. Do you have any links to reference material that describes this need. 2. I rebuilt my client side with the new wsdl and get the following exception: Non nillable element 'photoRef' is null This really doesn't surprise me since I took no steps in any code to set the photoRef element. So here's my question. Does one need to modify the addPhoto method in the xxxBindingStub class to expicity add the photo as a mime attachment part to the org.apache.axis.client.Call obect. What is then passed to the _call.invoke method? Do you just pass the com.examples.PhotoCatalog.types.PhotoInfo object and omit the image object since the attachment has already been added. I'm including the code snippet for the addPhoto method from xxxBindingStub class for reference public javax.xml.transform.Source addPhoto(com.examples.PhotoCatalog.types.PhotoInfo oldPhoto, java.awt.Image photo) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[0]); _call.setUseSOAPAction(true); _call.setSOAPActionURI(); _call.setEncodingStyle(null); _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); _call.setOperationName(new javax.xml.namespace.QName(, addPhoto)); setRequestHeaders(_call); setAttachments(_call); try {java.lang.Object _resp = _call.invoke(new java.lang.Object[] {oldPhoto, photo}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { extractAttachments(_call); try { return (javax.xml.transform.Source) _resp; } catch (java.lang.Exception _exception) { return (javax.xml.transform.Source) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class); } } } catch (org.apache.axis.AxisFault axisFaultException) { throw axisFaultException; regards Karl -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 2:24 PM To: axis-user@ws.apache.org Subject: Re: Exception parsing complex data type It turns out your WSDL isn't valid. Tell me if this is correct:: For the addPhoto operation, you want to pass in - the customer name (string) - a photo ID (int) - a photo (as an attachment) And you want to get in return - status (string) (currently you're trying to return this as an attachment, but I think you want to return it in the SOAP Body) For the replacePhoto operation, you want to pass in - the customer name (string) - a photo ID (int) - a photo (as an attachment) And you want to get in return - status (string) (currently you have this defined as type=wsi:swaRef, which doesn't make sense here. I assume that you want this to be a string returned in the SOAP Body) If that's the case, then here's a corrected WSDL: wsdl:definitions name=PhotoCatalogService targetNamespace=http://examples.com/PhotoCatalog; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:types=http://examples.com/PhotoCatalog/types; xmlns:mime=http://schemas.xmlsoap.org/wsdl/mime/; xmlns:tns=http://examples.com/PhotoCatalog; wsdl:types !-- ws-i schema -- xsd:schema
Re: Exception parsing complex data type
Karl, I probably wouldn't select a SOAP w/ Attachments WSDL as my first test case, but perhaps you enjoy self abuse... (I'm not sure that Axis supports the WS-I Attachments profile.) In any case, the first error is caused by the fact that Axis generated an RPC style message (it generated the addPhoto wrapper element), which it wasn't supposed to do. I'd appreciate it if you could post the code generated by Axis before you made the change to the WSDL. Axis should be able to consume any valid WSDL, and you shouldn't need to add the xsd:any element. (And the service wouldn't know how to process the contents of the xsd:any anyway.) Regards, Anne On 4/14/05, Schwarz, Karl [EMAIL PROTECTED] wrote: Hi, I need a little help getting started with AXIS. I've done some SOAP web services development a few years back using SUN JAXM, but I will be using AXIS for a webservice project in the near term. In order to get familiar with AXIS I did the GOOGLE thing and aquired a sample WDSL to try out. I am using 1.2RC3 version of AXIS with Tomcat 5.0.28. Here is the WSDL I first used: wsdl:definitions name=PhotoCatalogService targetNamespace=http://examples.com/PhotoCatalog; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:types=http://examples.com/PhotoCatalog/types; xmlns:mime=http://schemas.xmlsoap.org/wsdl/mime/; xmlns:tns=http://examples.com/PhotoCatalog; wsdl:types xsd:schema targetNamespace=http://examples.com/PhotoCatalog/types; xmlns:wsi=http://ws-i.org/profiles/basic/1.1/xsd; xmlns:types=http://examples.com/PhotoCatalog/types; xsd:import namespace=http://ws-i.org/profiles/basic/1.1/xsd; schemaLocation=WS-ISwA.xsd/ !-- Status contains the references the old photo available as attachment. -- xsd:element name=Status type=wsi:swaRef / !-- passed in as parameter of replacePhoto operation, contains the order. -- xsd:element name=PhotoInfo xsd:complexType xsd:sequence xsd:element name=customerName type=xsd:string/ xsd:element name=photoID type=xsd:int/ /xsd:sequence /xsd:complexType /xsd:element /xsd:schema /wsdl:types wsdl:message name=addPhotoRequest wsdl:part name=oldPhoto element=types:PhotoInfo/ wsdl:part name=photo type=xsd:hexBinary/ /wsdl:message wsdl:message name=addPhotoResponse wsdl:part name=status type=xsd:string/ /wsdl:message wsdl:message name=replacePhotoRequest wsdl:part name=oldPhoto element=types:PhotoInfo/ wsdl:part name=newPhoto type=xsd:hexBinary/ /wsdl:message wsdl:message name=replacePhotoResponse wsdl:part name=status element=types:Status/ /wsdl:message wsdl:portType name=PhotoCatalog wsdl:operation name=addPhoto wsdl:input message=tns:addPhotoRequest/ wsdl:output message=tns:addPhotoResponse/ /wsdl:operation wsdl:operation name=replacePhoto wsdl:input message=tns:replacePhotoRequest/ wsdl:output message=tns:replacePhotoResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=PhotoCatalogBinding type=tns:PhotoCatalog soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=addPhoto wsdl:input mime:multipartRelated mime:part soap:body parts=oldPhoto use=literal/ /mime:part mime:part mime:content part=photo type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output mime:multipartRelated mime:part soap:body use=literal/ /mime:part mime:part mime:content part=status type=text/plain/ mime:content part=status type=text/xml/ /mime:part /mime:multipartRelated /wsdl:output /wsdl:operation wsdl:operation name=replacePhoto wsdl:input mime:multipartRelated mime:part soap:body parts=oldPhoto use=literal/ /mime:part mime:part mime:content part=newPhoto type=image/jpeg/ /mime:part /mime:multipartRelated /wsdl:input wsdl:output mime:multipartRelated mime:part soap:body parts=status use=literal/ /mime:part /mime:multipartRelated /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=PhotoCatalogService wsdl:port name=PhotoCatalogPort binding=tns:PhotoCatalogBinding soap:address location=http://localhost:8080/jaxrpc-AttachmentsSample/photocatalog/ /wsdl:port /wsdl:service /wsdl:definitions When I used the previous WSDL to generate a service and then a client I got the following error on the client side when trying the addPhoto service: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: Invalid element in com.examples.PhotoCatalog.types.PhotoInfo - PhotoInfo faultActor: