English 中文(简体)
WADL: complex type from external xsd
原标题:

I need to test authentication procedure using the wadl file below:

<application xmlns="http://research.sun.com/wadl/2006/10" 
         xmlns:sis="http://sis.thecompany.com/" >
<grammars>
    <include href="http://localhost/wadl/sis.xsd"/>
</grammars>
<resources base="http://192.168.10.139">
    <resource path="/user/sign_in">
        <method name="POST" id="Authentication">
            <request>
                <param name="user" type="sis:user" required="true"/>
                <representation mediaType="application/xml" element="sis:user"/>
            </request>
            <response status="201">
                <representation mediaType="application/xml"/>
                <fault status="401" />
            </response>
        </method>
    </resource>
</resources>

After importing this file to the soapUI Pro I got no action by clicking to Request. The reason is that soapUI Pro does not see element "sis:user" as it present in xsdand thought that it is just some single element with undefined type. Can you advice wthat s wrong with the wadl file?

Below is the sis.xsd schema used:

<?xml version="1.0" encoding="utf-8"?> <xs:schema id="SIS" targetNamespace="http://sis.thecompany.com/" elementFormDefault="qualified" xmlns="http://sis.thecompany.com/" xmlns:mstns="http://sis.thecompany.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"> <xs:element name="application"> <xs:complexType> <xs:all> <xs:element name="user" minOccurs="0"> <xs:xs:complexType> <xs:all minOccurs="1"> <xs:element name="login" type="xs:string" /> <xs:element name="password" type="xs:string" /> </xs:all> </xs:complexType> </xs:element> </xs:all> </xs:complexType> </xs:element> </xs:schema>

And the next question. If soapUI Pro will correct parse complexType element user from xsd - POST data from soapUI Pro will be the next:

<sis:user><sis:login>admin</sis:login><sis:password>admin!</sis:password></sis:user>

But this will be rejected by server due to additional prefix sis: . Server support only the next format

<user><login>admin</login><password>admin!</password></user>

Please advice.

问题回答

The best advice I can give is to stop using WADL. Find a decent HTTP library and XML parser in whatever language you are using and create your XML file and POST it. It should take just a few lines of code to achieve this.

By using WADL and xsd the way you are doing, all you are achieving is creating tight coupling between the client and the server. This will negate the majority of the benefits a REST system is supposed to bring. You might as well stick with SOAP, at least the tooling is mature.





相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签