Hi Martin,

All the .jar files from the axis2-1.6.2/lib folder in axis2-1.6.2-bin.zip
as found at this URL are being copied into WEB-INF/lib:
http://axis.apache.org/axis2/java/core/download.cgi

That distribution .zip file doesn't have a stax-*.jar file in it, but
surely if that was missing then CURL requests wouldn't work for other
services either? It works fine as long as the request type doesn't extend
another type.

I'll raise an issue on JIRA. Thanks for the help.

Best regards,
Mike


On 15 April 2014 17:01, Martin Gainty <mgai...@hotmail.com> wrote:

>  <snip>
>
>
> webservices.wsdl:
>
> <definitions targetNamespace="http://campusm.gw.com/campusm";
>     xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:tns="
> http://campusm.gw.com/campusm";
>     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:soap12="
> http://schemas.xmlsoap.org/wsdl/soap12/";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="
> http://schemas.xmlsoap.org/wsdl/soap/";
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:cm="
> http://campusm.gw.com/campusm";
>     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";>
>
>     <types>
>         <schema elementFormDefault="qualified" targetNamespace="
> http://campusm.gw.com/campusm";
>             xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:apachesoap="
> http://xml.apache.org/xml-soap";
>             xmlns:tns="http://campusm.gw.com/campusm"; xmlns:intf="
> http://campusm.gw.com/campusm";
>             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:cm="
> http://campusm.gw.com/campusm";>
>
>             <include schemaLocation="webServiceXsdName.xsd" />
>
>             ...
>
>         </schema>
>     </types>
>
>     ...
>
> </definitions>
>
> webServiceXsdName.xsd:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns="http://campusm.gw.com/campusm"; targetNamespace="
> http://campusm.gw.com/campusm";
>     elementFormDefault="qualified">
>
>     <xsd:include schemaLocation="baseTypesXsdName.xsd" />
>
>     <xsd:element name="requestName">
>         <xsd:complexType>
>             <xsd:complexContent>
>                 <xsd:extension base="requestBaseType">
>                     <xsd:sequence>
>                         <xsd:element name="param1" type="xsd:int"
> minOccurs="0" maxOccurs="1" />
>                     </xsd:sequence>
>                 </xsd:extension>
>             </xsd:complexContent>
>         </xsd:complexType>
>     </xsd:element>
>
>     ...
>
> </xsd:schema>
>
> baseTypesXsdName.xsd:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns="
> http://campusm.gw.com/campusm"; targetNamespace="
> http://campusm.gw.com/campusm"; elementFormDefault="qualified">
>
>     <xsd:complexType name="requestBaseType">
>         <xsd:sequence>
>             <xsd:element name="baseParam1" type="xsd:int" minOccurs="1"
> maxOccurs="1" />
>             <xsd:element name="baseParam2" type="xsd:string" minOccurs="1"
> maxOccurs="1" />
>             <xsd:element name="baseParam3" type="xsd:boolean"
> minOccurs="0" maxOccurs="1" default="true" />
>             <xsd:element name="baseParam4" type="xsd:boolean"
> minOccurs="0" maxOccurs="1" default="false" />
>             <xsd:element name="baseParam5" type="xsd:boolean"
> minOccurs="0" maxOccurs="1" default="false" />
>         </xsd:sequence>
>     </xsd:complexType>
>
> </xsd:schema>
>
> Is there some problem with this include structure? If there's a problem
> with the .wsdl, why would SoapUI load it just fine and
> org.apache.axis2.tool.ant.AntCodegenTask generate the code for this web
> service from it without a problem?
>
> MG>Each of the referenced XSDs are included (so there should not be a
> problem)
> MG>and youre stying following the example CodegenToolReference at
> MG>
> http://axis.apache.org/axis2/java/core/tools/CodegenToolReference.html#example
> MG>then that indicates your XML processors are setup correctly
> MG>When the element resolution is resolved ...if the any of the versions
> are off
> MG>more specifically if the stax version is off at runtime != compile time
> stax
> MG>then you would definitely see this error ...
> MG>FYI these are the jars that must be prepended to CLASSPATH at compile
> time and runtime
> MG>could you confirm all of these jars would be loaded to WEB-INF/lib ?
>  axis2-*.jar (from the Axis2 distribution)
> wsdl4j-1.6.2.jar or higher (The WSDL4J implementation jar. Bundled with
> the Axis2 distribution)
> stax-api-1.0.1.jar (The StAX API's that contain the
> javax.xml.namespace.QName class. This jar may be replaced by any other jar
> that contains the javax.xml.namespace.QName implementation. However Axis2
> uses this class from the stax-api-1.0.1.jar which comes bundled with the
> Axis2 distribution) /* iterative, event-based processing of XML documents */
> commons-logging-1.1.jar,
>
> neethi-2.0.jar  /*Implementation of WS-POLICY */
> and
> XmlSchema-1.2.jar (from the Axis2 distribution) /*XML Schema
> representations */
> axiom-api-1.2.1.jar and axiom-impl-1.2.1.jar (from the Axis2 distribution)
> activation-1.1.jar (from the Axis2 distribution)
> wstx-asl-3.1.0.jar (from the Axis2 distribution) /*StAX-compliant
> (JSR-173) XML Processor */
>
> MG>the discontinuity between SOAP-UI and Browser sounds serious enough to
> file a JIRA bug report
> MG>if for no other reason than to properly capture environment details
> (such as which Browser and which version)
> https://issues.apache.org/jira/browse/AXIS2
> Best regards,
> Mike
>
>
> On 15 April 2014 12:05, Martin Gainty <mgai...@hotmail.com> wrote:
>
>  Mike-
>
> Axis needs to reference the defining XSD
> SOAPUI caches the xsd
> change the "Cache Definitions" bottom-left property for the containing
> project to false (if you want to see the error)
>
> http://www.soapui.org/SOAP-and-WSDL/working-with-ws-attachments-and-inline-files.html
>
> Browser doesnt know where to find XSD or any of the elements defined
> within XSD so it gacks
>
>
> "It is a common misperception to equate the targetNamespace of an XML
> schema or the value of the *xmlns* attribute in XML instances with the
> location of the corresponding schema.
>
> Since namespaces are in fact *URIs*, and *URIs may be locations*, and *you
> may be able to retrieve a schema from that location*,
>
> it does not mean that is the only schema that is associated with that
> namespace.
> There can be multiple schemas associated with a particular namespace, and
> it is up to a processor of XML to determine which one to use in a
> particular processing context. The WSDL specification provides the
> processing context here via the *<import>* mechanism, which is based on
> the XML schemas grammar for the similar concept"
> http://www.w3.org/TR/wsdl
>
> *to use a specific XSD location use xs:import *e.g.
> <xs:import namespace="http://www.w3schools.com/schema"/>
> http://www.w3schools.com/schema/el_import.asp
>
> HTH
> Martin
> ______________________________________________
>
>
>
>
>  ------------------------------
> Date: Tue, 15 Apr 2014 09:28:28 +0100
>
> Subject: Re: Browser/CURL requests to WS w/response extending a type
> From: mike.ha...@ombiel.com
> To: java-user@axis.apache.org
>
>
>  Hi Doug,
>
> That is an important fact, but unfortunately I see the same problem with
> POST as I do with GET. It looks like I forgot to mention that. I'm using
> POST with CURL, but I used GET in a browser to do some of the testing.
>
> Best regards,
> Mike
>
>
> On 14 April 2014 15:58, Newton, Doug <doug.new...@suddenlink.com> wrote:
>
>  Hi Mike,
>
> This is just a side-bar comment regarding curl.  You probably already know
> this, and are probably locked into having to do a GET for some reason, but
> just in case I wanted to make sure you knew that you can POST a complete
> SOAP envelope with curl.  That is the way I always curl into a
> web-service.  I've never relied on the bonus feature of being able to make
> a shortcut GET request.  That isn't a web-service specified capability.
>
> You can curl a file containing the request for the POST:
>
> curl --data @request.xml http://ws.myco.com/services/soap/MyService
>
> You can curl the request inline on the command:
>
> curl --data "<full soap XML request>"
> http://ws.myco.com/services/soap/MyService
>
> or pipe the request in:
>
> echo '<full soap XML request>' | curl -X POST -H 'Content-type: text/xml'
> -d @- http://ws.myco.com/services/soap/MyService
>
> Doug Newton
> Systems Architect
> Suddenlink Communications, Customer Solutions
> (physical address) 575 Maryville Centre Dr., Suite 300 | St. Louis, MO
> 63141
> (mailing address) 520 Maryville Centre Dr., Suite 300 | St. Louis, MO
> 63141
> (office phone) 314-315-8442
> (mobile phone) 314-803-6778
>
> *There are only two hard things in Computer Science: cache invalidation,
> naming things, and off-by-one errors.*
> *-Martin Fowler*
>
> *From:* Mike Hawes [mailto:mike.ha...@ombiel.com]
> *Sent:* Monday, April 14, 2014 4:25 AM
> *To:* java-user@axis.apache.org
> *Subject:* Re: Browser/CURL requests to WS w/response extending a type
>
>  Hi Shameera,
>
> I'm afraid there are no log messages there at all for that request, in any
> of the standard tomcat logs or our Log4J setup, not even an access request.
> Is there some specific Axis2 logging I should enable?
> Best regards,
> Mike
>
>  On 11 April 2014 18:43, Shameera Rathnayaka <shameerai...@gmail.com>
> wrote:
>  Hi Mike,
>  Do you see any exception in servers side logs? if there is, send the
> stack trace of server side too?
>  Thanks,
> Shameera.
>
>  On Fri, Apr 11, 2014 at 3:42 PM, Mike Hawes <mike.ha...@ombiel.com>
> wrote:
>  I've written a web service with Axis2 1.6.2 with a request that extends
> another type, with a request element that looks like this in its .xsd:
>
> <xsd:element name="requestName">
>     <xsd:complexType>
>         <xsd:complexContent>
>             <xsd:extension base="requestBaseType">
>                 <xsd:sequence>
>                     <xsd:element name="param1" type="xsd:int"
> minOccurs="1" maxOccurs="1" />
>                     <xsd:element name="param2" type="xsd:string"
> minOccurs="1" maxOccurs="1" />
>                     <xsd:element name="param3" type="xsd:int"
> minOccurs="0" maxOccurs="1" />
>                 </xsd:sequence>
>             </xsd:extension>
>         </xsd:complexContent>
>     </xsd:complexType>
> </xsd:element>
>
> <xsd:complexType name="requestBaseType">
>     <xsd:sequence>
>         <xsd:element name="baseTypeParam1" type="xsd:string" minOccurs="0"
> maxOccurs="1" />
>     </xsd:sequence>
> </xsd:complexType>
>
>
>  Sending requests to this web service works just fine if I send the
> requests from SoapUI or similar, but if I send the same request via GET
> from a browser I get this error:
>
> <faultstring>org.apache.axis2.databinding.ADBException: Unexpected
> subelement {http://campusm.gw.com/campusm}requestName</faultstring>
>  It's saying there's an unexpected element of a type that is the correct
> request type, even though in a GET request that request object is implicit.
>
>  If I stop it extending requestBaseType, it works fine in both the browser
> and SoapUI. Here's the xsd definition that fixes the problem:
>
> <xsd:element name="requestName">
>     <xsd:complexType>
>         <xsd:sequence>
>              <xsd:element name="baseTypeParam1" type="xsd:string"
> minOccurs="0" maxOccurs="1" />
>             <xsd:element name="param1" type="xsd:int" minOccurs="1"
> maxOccurs="1" />
>             <xsd:element name="param2" type="xsd:string" minOccurs="1"
> maxOccurs="1" />
>             <xsd:element name="param3" type="xsd:int" minOccurs="0"
> maxOccurs="1" />
>         </xsd:sequence>
>     </xsd:complexType>
> </xsd:element>
>
> Here's an example of the GET request I send in the browser that gets this
> error:
>
>
> http://localhost:8080/path/to/webservice?baseTypeParam1=stuff&param1=12&param2=thing&param3=13
>
>  Here's an example of the request I send from SoapUI that works:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:cam="http://campusm.gw.com/campusm";>
>    <soapenv:Header/>
>    <soapenv:Body>
>       <cam:requestName>
>           <cam:baseTypeParam1>stuff</cam:baseTypeParam1>
>           <cam:param1>12</cam:param1>
>          <cam:param2>thing</cam:param2>
>          <cam:param3>13</cam:param3>
>       </cam:requestName>
>    </soapenv:Body>
> </soapenv:Envelope>
>
>  I need the request to extend a type so that I can have multiple web
> services sending a large common subset of their request parameters to the
> same function in my Java code. This would allow the function to take a
> parameter of the base request type, and have each web service just pass its
> request into that function without any conversion or worring about the
> individual parameters at that point.
>  I also need to be able to call the web services with CURL, which is not
> possible if the web services won't work with a GET request.
>  This seems to be a bug with Axis2. Is this a known issue and will it be
> fixed?
>
>  Best regards,
> Mike
>
> --
> campusM: http://www.campusM.com
> Email: mike.ha...@ombiel.com
> Tel: 01902 837451
>
>
>
> --
>  Best Regards,
> Shameera Rathnayaka.
>
>  email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
>
>
> --
> campusM: http://www.campusM.com
> Email: mike.ha...@ombiel.com
> Tel: 01902 837451
> ------------------------------
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain proprietary, confidential and/or
> legally privileged material. Any review, retransmission, dissemination or
> other use of, or taking of any action in reliance upon, this information by
> persons or entities other than the intended recipient is prohibited. If you
> received this in error, please contact the sender and delete the material
> from all computers.
> ------------------------------
>
>
>
>
> --
> campusM: http://www.campusM.com
> Email: mike.ha...@ombiel.com
> Tel: 01902 837451
>
>
>
>
> --
> campusM: http://www.campusM.com
> Email: mike.ha...@ombiel.com
> Tel: 01902 837451
>



-- 
campusM: http://www.campusM.com
Email: mike.ha...@ombiel.com
Tel: 01902 837451

Reply via email to