David Thielen wrote:

Hi;

I am new to web services and so I’m at a loss as to the best way to design a Web Services interface for our reporting package. Basically the package has 2 input files and a couple of settings and generates an output file. For the architecture of this I have a couple of questions:

1a) If I want C# as well as java apps able to easily interface with the service, is JAX-RPC the way to go?

You can get an interoperable rpc oriented service working but .NET/C# favors doc/lit. IMHO, with the improved doc/lit support in axis its your best bet for interop.


1b) I can see the request as being either a set of variables (parameters) with a return variable (RPC) – or – as an input SOAP message with some attributes and 2 attachments that returns an attachment (the attachments being all data from a stream – that is not necessarily a file).

I'd stay away from attachments for the time being - unless they are binary or very large - say greater than 1MB. Attachments support in the various toolkits is spotty.


1c) And if the answer is not RPC, which of the other 3 axis supported protocols should I use? (And it’s critical that the solution I use is supported by C# and preferably by most other development environments.)

I would suggest you tend to Document or Message style. These are really the same thing in terms of the web service design. Its a doc/lit service you are making but you consume the XML differently in both cases. With Message style you handle the XML directly with XML apis. In Document you can still use an XML<->Java language binding mechanism. But again, its the same old web service to the rest of the world so at a WS design level it doesn't matter which internal axis aPI you choose for implementation.




2) I have 2 hash maps I need to pass across. However, it says for C# to not pass hash maps. Any suggestions on the best way to pass the data in hash maps?

Model the data in XML and pass those XML types. Don't expect either toolkit to map your native data into XML types automagically. You'll have to take extra steps for that to happen. Assume the toolkits will do it wrong - cause from each others perspective they will.


Think of it this way - you hash map is just more XML data:

<schema targetNamespace="urn:yourns" ...>
   <complexType name="map">
      <sequence>
         <element name="item"
            minOccurs="0"
            maxOccurs="unbounded" >
            // assume string based key
            <element name="key type="xsd:string" />
         // or to your data structure - as XML
         <element name="value type="xsd:string" />
      </element
   </complexType>


<element name="map1" type"map"/> <element name="map2" type"map"/>

</schema>



3) Does an ArrayList serialize to an array (ie a []) in the SOAP data passed?

It turns out that the .NET System.collections.ArrayList does generate the equivalent of an XML array - but an array of anyType since like in Java ArrayList is an array of Objects:


...
<element name="HelloWorldResponse">
   <complexType>
      <sequence>
         <element minOccurs="0" maxOccurs="1"
               name="HelloWorldResult" type="s0:ArrayOfAnyType" />
      </sequence>
   </complexType>
</element>

<complexType name="ArrayOfAnyType">
   <sequence>
      <element minOccurs="0" maxOccurs="unbounded"
           name="anyType" nillable="true" />
   </sequence>
</complexType>
...

If you wanted any kind of type safety you could model the array yourself be hand rolling the WSDL/Schema to reference your types.


Hope this helps,


Jim Murphy





Reply via email to