ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Nichol <snic...@computer.org>
Subject Re: java client for .NET webservice and Co
Date Wed, 20 Feb 2002 16:21:32 GMT
Apache SOAP does not use XSD or WSDL.  It is based on serializing and
deserializing Java classes.  There is no tool to generate the Java classes
or serialization code from XSD or WSDL.  There are other SOAP
implementations for Java (e.g. GLUE and Idoox) that *may* do this, but I am
not sufficiently familiar with these to be certain.

Personally, I do not care for the technique of turning everything into a
string.  Of course, I don't like storing and passing data as DataSets,
either.  My preference is to pass "objects" that have some meaning to your
application domain.  For example, you appear to be sending a DataSet
consisting of "company" data, including related "contract" information.
Were I implementing this, I would be using Company and Contract classes,
passing an array of Company instances as a method parameter rather than a
DataSet.

Roughly, this would look like

public class Contract implements org.apache.xml.Serializer {
    // even better: use accessor/mutator (getter/setter) methods
    public String ContractNo;
    public String CustomerCode;
    public String CODA_CreditAccountCode;
    public String CODA_DebitAccountCode;
    public String CODA_CustomerCode;

  public void marshall(String inScopeEncStyle, Class javaType, Object src,
                       Object context, Writer sink, NSStack nsStack,
                       XMLJavaMappingRegistry xjmr, SOAPContext ctx)
    throws IllegalArgumentException, IOException {
    // code to write this data as XML
    }

    ...
}

public class Company implements org.apache.xml.Serializer {
    public String CompanyId;
    public String Name;
    public String AddressLine1;
    ...
    public Contract[] contracts;

  public void marshall(String inScopeEncStyle, Class javaType, Object src,
                       Object context, Writer sink, NSStack nsStack,
                       XMLJavaMappingRegistry xjmr, SOAPContext ctx)
    throws IllegalArgumentException, IOException {

    // code to write this data as XML
    }

    ...
}

As you can see, I present a fairly mechanical translation of XSD to Java, so
it is clear that a tool could be written to do this programmatically, but as
I said, there is not one included in Apache SOAP.

So, that is how I would do this.  That does not mean it is wrong or
impossible to either use a DataSet or turn everything into a single string.
I just happen to think that using Company and Contract makes the semantics
of the SOAP method more clear, and it provides a straight forward way to
write a client in any programming language.

Scott Nichol

----- Original Message -----
From: <Elise_Dupont@lionbridge.com>
To: <soap-dev@xml.apache.org>
Sent: Wednesday, February 20, 2002 10:43 AM
Subject: RE: java client for .NET webservice and Co


even if i do have an xsd file ? it's a shema of the dataset right ?
so you think i should send X strings in stead of one xml object, and then
it's up to the .NET webservice to get those strings and create it's own
dataset with ? (or to insert them in the SQL server DB directly) ? (i ask
you because english is not my native language so i'm affraid not to
understand everything)
thanks


--------------------------------------------
Elise Dupont
Software developer
Technology Development Group Europe
Lionbridge Technologies - France
Buropolis 1 - 1240 route des Dolines
06560 Sophia-Antipolis
www.lionbridge.com





"Jean-Yves MENGANT" <jymengant@ifrance.com>
02/20/2002 04:32 PM
Please respond to soap-dev


        To:     <soap-dev@xml.apache.org>
        cc:
        Subject:        RE: java client for .NET webservice and Co



Hi ,

Sending a dataset using the SOAP protocol is simply impossible for the
following reasons :

  1 There is no definition of what a dataset is inside the  XmlSchema
basic types.
   2 A dataset may contain undefined binary data that will not comply with
http  protocol usually
used  at the transport layer when using SOAP, and which would imply extra
transport  semantics
like  for instance UUEncoding the data before sending.

=>  you need to read the dataset and transfert it's content. Event if the
file  contains dynamic Xml defs which
seems  to be the case here , you simply can send the full content using an
xs:string  type.

Jean-Yves
-----Message d'origine-----
De :  Elise_Dupont@lionbridge.com  [mailto:Elise_Dupont@lionbridge.com]
Envoyé : Wednesday,  February 20, 2002 2:59 PM
À :  soap-dev@xml.apache.org
Objet : Re: java client for .NET  webservice and Co





i also do have a WSD file :

============
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="dsCompany" targetNamespace="http://tempuri.org/dsCompany.xsd"
elementFormDefault="qualified"  attributeFormDefault="qualified"
xmlns="http://tempuri.org/dsCompany.xsd"
xmlns:mstns="http://tempuri.org/dsCompany.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
         <xs:element  name="dsCompany" msdata:IsDataSet="true">
                 <xs:complexType>
                         <xs:choice maxOccurs="unbounded">
                                  <xs:element name="T_Company">
                                          <xs:complexType>
                                                  <xs:sequence>
                                                           <xs:element
name="COMP_CompanyId" type="xs:string"/>
                                                           <xs:element
name="COMP_Name" type="xs:string" minOccurs="0"/>
                                                           <xs:element
name="COMP_AddressLine1" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_AddressLine2" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_City" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_StateCode" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_Zip" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_CountryCode" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_PhoneNumber" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_FaxNumber" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_website" type="xs:string"  minOccurs="0"/>
                                                          <xs:element
name="COMP_CurrencyCode" type="xs:string"/>
                                                           <xs:element
name="COMP_LocalVend" type="xs:boolean"/>
                                                           <xs:element
name="COMP_Customer" type="xs:boolean"/>
                                                           <xs:element
name="COMP_Agency" type="xs:boolean"/>
                                                           <xs:element
name="COMP_LBSite" type="xs:boolean"/>
                                                           <xs:element
name="T_Customer">

<xs:complexType>

<xs:sequence>

         <xs:element  name="COMP_CompanyId" type="xs:string"/>

        <xs:element name="ContractNo" type="xs:string" minOccurs="0"/>

         <xs:element name="CustomerCode" type="xs:string" minOccurs="0"/>

         <xs:element name="CODA_CreditAccountCode"  type="xs:string"
minOccurs="0"/>

         <xs:element name="CODA_DebitAccountCode"  type="xs:string"
minOccurs="0"/>

         <xs:element name="CODA_CustomerCode"  type="xs:string"
minOccurs="0"/>

 </xs:sequence>

</xs:complexType>
                                                           </xs:element>
                                                  </xs:sequence>
                                          </xs:complexType>
                                  </xs:element>
                         </xs:choice>
                 </xs:complexType>
                 <xs:unique name="dsCompanyKey2" msdata:PrimaryKey="true">
                         <xs:selector xpath=".//mstns:T_Company"/>
                         <xs:field xpath="mstns:COMP_CompanyId"/>
                 </xs:unique>
         </xs:element>
</xs:schema>


With all those  elements, should i be able to transform a java object in
what is experting  .NET ? and how ?






Elise_Dupont@lionbridge.com

02/20/2002 01:17 PM
Please respond to soap-dev


        To:         soap-dev@xml.apache.org
        cc:
         Subject:        Re: java client for .NET  webservice and Co




okay so after have looked at many documentation, i didn't find  the
solution so i post my question here :

what i must create is a  java client that sends a DataSet to a .NET
webservice. This webservice takes  the DataSet and add it into a SQL
server database.
My  problem is : how to create a DataSet understandable by Microsoft ? I
first  have a java object (myCompanyObject, with the name, the address
etc...)

So is the DataSet created by a class that  transforms objects into DataSet
? or is it performed by a xml, wsdl, something  file ? (my knowledge about
wsdl is very small) ??? even better : how would  look like the code for a
"object to DataSet" transformation in some sample  lines ?


here is the doc about my .NET webservice

SOAP
The following is a sample SOAP request and response.  The placeholders
shown need to be replaced with actual values.


POST /PCS_Integration/SynchronizeProfiles.asmx HTTP/1.1
Host:  biztalk
Content-Type: text/xml; charset=utf-8
Content-Length:  length
SOAPAction:  "http://tempuri.org/WS_UpdateProfileAgency"

<?xml version="1.0"  encoding="utf-8"?>
<soap:Envelope  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
   <WS_UpdateProfileAgency xmlns="http://tempuri.org/">
     <dsComp>dataset</dsComp>
   </WS_UpdateProfileAgency>
</soap:Body>
</soap:Envelope>





HTTP/1.1 200 OK
Content-Type: text/xml;  charset=utf-8
Content-Length: length

<?xml version="1.0"  encoding="utf-8"?>
<soap:Envelope  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
   <WS_UpdateProfileAgencyResponse xmlns="http://tempuri.org/">
     <WS_UpdateProfileAgencyResult>boolean</WS_UpdateProfileAgencyResult>
   </WS_UpdateProfileAgencyResponse>
</soap:Body>
</soap:Envelope>


Regards,
Elise






Mime
View raw message