axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Hawes <mike.ha...@ombiel.com>
Subject Re: Browser/CURL requests to WS w/response extending a type
Date Tue, 15 Apr 2014 08:28:28 GMT
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.Newton@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.hawes@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 <shameerainfo@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.hawes@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.hawes@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.hawes@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.hawes@ombiel.com
Tel: 01902 837451

Mime
View raw message