If you want to send an Element using SOAP encoding, you would need to 
create a serializer and deserializer.  The "standard" way to send an 
element using Apache SOAP is to use literal XML encoding, which the 
getAllAddresses sample does.  This will not interoperate with many 
(any?) other SOAP implementations.

On 4 Jun 2003 at 20:54, Vishal Shah wrote:

> Correct me if I'm wrong, but this requires defining de/serializer for this object 
> type. 
>  
> There is a difference between an XML file (Document) and Element (DOM element).
>  
> VS
> 
> Parames <[EMAIL PROTECTED]> wrote:
> Thanks Jonathan
> 
> --- Jonathan Roberts wrote:
> > Hi.
> > 
> > You can presumably only send an XML element if you
> > define it as an object, and pass this over.
> > 
> > RegisterSettings just sets up which xml-app to use.
> > 
> > Jonathan
> > 
> > Parames wrote:
> > HI ,
> > Thanks a lot ..
> > The same logic is working for me with java bean....
> > im trying to pass XML element to service instead of
> > string...ie.XML file.
> > Im getting string from client side but need to send
> > as
> > Element ...
> > im dont want to use java bean..
> > any idea??
> > And what is call.registerSettings() method do??
> > 
> > REgards
> > parames
> > 
> > --- Jonathan Roberts wrote:
> > > Something like this (code not tested)
> > >
> >
> --------------------------------------------------------------------------------------
> > > Client side
> > > ----------------
> > > String returnString = "";
> > > Call c=new Call();
> > > c = registerSettings( c );
> > > c.setMethodName ("fetchData"); 
> > > //fetchData is name of server side method
> > > // Set up parameters to pass
> > > Vector parameters = new Vector();
> > > String customerID = "2100"; // or get cusotmerID
> > > from elsewhere!
> > > parameters.addElement (new Parameter("customerID",
> > > String.class, customerID, null));
> > > c.setParams (parameters);
> > > Response r=null; 
> > > try
> > > {
> > > // where mstrHostString = http://soapServer:8080
> > > // in other words ip & port you have soap on
> > > r = c.invoke ( new URL( mstrHostString +
> > > "/soap/servlet/rpcrouter"), "" );
> > > }
> > > catch ( Exception e )
> > > {
> > > System.out.println ("exception service not
> > > available on " + mstrHostString);
> > > return;
> > > }
> > > // Check the response.
> > > if (r.generatedFault ()) 
> > > {
> > > Fault f = r.getFault();
> > > System.out.println (" Fault Code = " +
> > > f.getFaultCode());
> > > System.out.println (" Fault String = " +
> > > f.getFaultString());
> > > } 
> > > else 
> > > {
> > > Parameter returnObject = r.getReturnValue(); 
> > > // return vector of objects - e.g. strings
> > > //Vector returnVector =
> > > (Vector)returnObject.getValue(); 
> > > //returnString = (String) returnVector.get( 0 );
> > > or
> > > // return just one string
> > > returnString = (String)returnObject.getValue(); 
> > > }
> > > 
> > > public Call registerSettings( Call c )
> > > { 
> > > // SET TARGET URI
> > > c.setSOAPTransport(httpConn); 
> > > c.setTargetObjectURI ("urn:xml-APP"); // name of
> > > app in soap admin
> > > // SET METHOD BEING CALLED ON SERVER
> > > c.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 
> > > 
> > > return c;
> > > }
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > 
> > > 
> > > server side
> > > --------------
> > > You need to specify the method names you are
> > calling
> > > in soap in soap admin for xml-APP. 
> > > 
> > > XML code :
> > > 
> > > call:
> > > java org.apache.soap.server.ServiceManagerClient :
> > >
> > /soap/servlet/rpcrouter">http://:
> > /soap/servlet/rpcrouter
> > > deploy C:\soapcode\Deploy.xml
> > > 
> > > code:
> > > 
> > > 
> > >
> >
> -------------------------------------------------------------------
> > > 
> > > > "http://xml.apache.org/xml-soap/deployment";
> > > 
> > > id="urn:xml-App">
> > > 
> > > > 
> > > methods="fetchData">
> > > 
> > > >
> >
> class="com.yourcompany.yourpackage.serversideclass"/>
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > org.apache.soap.server.DOMFaultListener
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> >
> --------------------------------------------------------------------------------------
> > > 
> > > code in serversideclass
> > > 
> > > public Vector fetchData( String customerID) 
> > > 
> > > { 
> > > // access your dastabase bean with customerID
> > > 
> > > return returnVector;
> > > }
> > > 
> > > or
> > > 
> > > 
> > > 
> > > public String fetchData( String customerID) 
> > > 
> > > { 
> > > // access your dastabase bean with customerID
> > > 
> > > return returnString;
> > > }
> > > 
> > > 
> > > 
> > > Hope this helps. Dont know if this is perfect, but
> > > this is the way I do it.
> > > 
> > > Regards
> > > 
> > > Jonathan
> > > 
> > > 
> > > 
> > > Parames wrote:
> > > Thanks for your response ,
> > > Any i have query ,Im trying to send string as
> > > XML(Element) to the service where service needs to
> > > fetch string matching datas from database.
> > > XML like Addressbook example..
> > > 
> > > Can anyone send me some code for 
> > > sending stringas element,Bcoz in service im
> > passing
> > > resultset to element.
> > > Can anyone help me??
> > > 
> > > My GUI code 
> > > 
> > > public void actionPerformed(ActionEvent event)
> > > {
> > > String but = event.getActionCommand();
> > > if (but == "OK" )
> > > {
> > > // IdToLookUp is the value i want to take 
> > > IdToLookUp =jTextField1.getText();
> > > 
> > > 
> > > // HERE the STRING TO PASS AS ELEMENT
> > > 
> > > DocumentBuilder xdb =
> > > XMLParserUtils.getXMLDocBuilder();
> > > Document doc = xdb.newDocument();
> > > Element custID = doc.createElement("CustomerID");
> > >
> > custID.appendChild(doc.createTextNode(IdToLookUp));
> > > 
> > > 
> > > //make a call to soap server with customer ID
> > > 
> > > try{
> > > 
> > > // GetCustInfo() is the SOAP CLIENT where i need
> > to
> > > pass this element...
> > > 
> > > gci = new GetCustInfo();
> > > 
> > > Element element =gci.callCustSVC(customerId);}
> > > catch (Exception e) {
> > > e.printStackTrace();
> > > System.out.println("ERROR "+e);
> > > }
> > > }
> > > 
> > >
> >
> -------------------------------------------------------
> > > Thanks in advance
> > > Expecting to hear from you
> > > regards
> > > parames
> > > 
> > > 
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Calendar - Free online calendar with sync
> > to
> > > Outlook(TM).
> > > http://calendar.yahoo.com
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------
> > > Yahoo! Plus - For a better Internet experience
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to
> > Outlook(TM).
> > http://calendar.yahoo.com
> > 
> > 
> > 
> > ---------------------------------
> > Yahoo! Plus - For a better Internet experience
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> ---------------------------------
> Do you Yahoo!?
> Free online calendar with sync to Outlook(TM).


Scott Nichol

Do not reply directly to this e-mail address,
as it is filtered to only receive e-mail from
specific mailing lists.


Reply via email to