开发者

Converting complex SOAP requests to REST URIs

I am trying to creat开发者_开发问答e a REST web service which provides the exact same functionality as an existing SOAP based web service. Some soap requests can be quite complex and I am having trouble figuring out how these could be mapped to URIs. For example the following SOAP method body represents a search:

    <HLRequest>
        <HLSearch correlId=”1”>
        <criteria numHLs="10" Level="AND" matchAll="true" exactHitCount="true" suppTemp="true" suppHLOnly="true" chainHLOnly="true" startDate="2011-01-01T00:00:00" endDate="2011-01-07T23:59:59">>
            <symbols>
                <symbol>CSCO</symbol>
                <symbol>IBM</symbol>
                <symbol>MSFT</symbol>
            </symbols>
        </criteria>
        </HLSearch>
        <HLSearch correlId=”2”>
        <criteria numHLs="10">
            <symbols>
                <symbol>GOOG</symbol>
            </symbols>
        </criteria>

         </HLSearch>
    </HLRequest>

So I need to construct a method which handles URIs with an indefinite number of repeating query parameters and I'm not sure how/if this can be done within the REST paradigm.

Thanks in advance, Ned


Your problem is that you're too hung up on a design pattern. There are things that REST is good for, and things that it's not good for, and you've just found one of the latter. You could come up with some scheme to map this data to a URI, but why would you want to? What problem would that solve? For this data, XML is probably the best way to represent it, so why not just post the XML?


Do you really need to map them all to URIs? A better approach for complex data is to make some json and post that. Apache CXF JAX-RS support can them automatically map that to bean classes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜