You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Mike Kopack <mk...@isx.com> on 2002/10/18 17:19:00 UTC

Need help creating a custom type mapping

Hey guys,

Ok, I'm pretty lost. I keep looking at vartious documentation but either they seem to leave out important pieces of the puzzle or they're not doing things in the same way I am.

First of all, I'm writing a client/server app using Apache SOAP (latest version) and Java. I'm utilizing the SOAP-RPC method calling proceedures.

So, on my client side I have something that looks like this:

public String login(SecurityAssertion sa, String clienttype)
 {
  String returnValue  = null;
  try
  {
   Call call                = new Call();
   call.setTargetObjectURI(targetObjectURI);
   call.setMethodName("login");
   call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

   Vector v                 = new Vector(2);
   v.addElement(new Parameter("sa", SecurityAssertion.class, sa, null));
   v.addElement(new Parameter("clienttype", String.class, clienttype, null));
   call.setParams(v);
   Response r               = call.invoke(url, "");
   if (!r.generatedFault())
   {
    Parameter returnParameter  = r.getReturnValue();
    returnValue = returnParameter.getValue();
   }
   else
   {
    System.out.println("Fault encountered : " + r.getFault().getFaultString());
   }
  }
  catch (Exception e)
  {
   e.printStackTrace();
  }
  return (String) returnValue;
 }



What I can't seem to figure out is how to create a mapping for how that "SecurityAssertion" class should be encoded, etc.  I understand that there is a server side and a client side mechanism that must be done, but I can't seem to find good CLEAR documentation with a complete step by step example on how to do this. I've currently got the SecurityAssertion class setup up as a Javabean, but I'm probably going to have to make it not one in the future, so some help in how to build the custom serializer/deserializer would be helpful as well.

Thanks!

--Mike

Re: Need help creating a custom type mapping

Posted by Scott Nichol <sn...@scottnichol.com>.
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/docs/guide/se
rializer.html is the latest documentation on type mapping; I just added
a client code snippet from the addressbook sample.  This page has a link
to show the general addition that must be made to the deployment
descriptor.  For a concrete example, look at the address book sample
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/samples/addre
ssbook/DeploymentDescriptor.xml.

That covers mapping and the use of BeanSerializer.  For a custom
serializer, my best recommendation is the same as the docs: look at the
source of one of the existing ones.  And, as always, Google might lead
you to something useful.

Scott Nichol
----- Original Message -----
From: "Mike Kopack" <mk...@isx.com>
To: <so...@xml.apache.org>
Sent: Friday, October 18, 2002 11:19 AM
Subject: Need help creating a custom type mapping


Hey guys,

Ok, I'm pretty lost. I keep looking at vartious documentation but either
they seem to leave out important pieces of the puzzle or they're not
doing things in the same way I am.

First of all, I'm writing a client/server app using Apache SOAP (latest
version) and Java. I'm utilizing the SOAP-RPC method calling
proceedures.

So, on my client side I have something that looks like this:

public String login(SecurityAssertion sa, String clienttype)
 {
  String returnValue  = null;
  try
  {
   Call call                = new Call();
   call.setTargetObjectURI(targetObjectURI);
   call.setMethodName("login");
   call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

   Vector v                 = new Vector(2);
   v.addElement(new Parameter("sa", SecurityAssertion.class, sa, null));
   v.addElement(new Parameter("clienttype", String.class, clienttype,
null));
   call.setParams(v);
   Response r               = call.invoke(url, "");
   if (!r.generatedFault())
   {
    Parameter returnParameter  = r.getReturnValue();
    returnValue = returnParameter.getValue();
   }
   else
   {
    System.out.println("Fault encountered : " +
r.getFault().getFaultString());
   }
  }
  catch (Exception e)
  {
   e.printStackTrace();
  }
  return (String) returnValue;
 }



What I can't seem to figure out is how to create a mapping for how that
"SecurityAssertion" class should be encoded, etc.  I understand that
there is a server side and a client side mechanism that must be done,
but I can't seem to find good CLEAR documentation with a complete step
by step example on how to do this. I've currently got the
SecurityAssertion class setup up as a Javabean, but I'm probably going
to have to make it not one in the future, so some help in how to build
the custom serializer/deserializer would be helpful as well.

Thanks!

--Mike



Re: Need help creating a custom type mapping

Posted by Scott Nichol <sn...@scottnichol.com>.
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/docs/guide/se
rializer.html is the latest documentation on type mapping; I just added
a client code snippet from the addressbook sample.  This page has a link
to show the general addition that must be made to the deployment
descriptor.  For a concrete example, look at the address book sample
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/samples/addre
ssbook/DeploymentDescriptor.xml.

That covers mapping and the use of BeanSerializer.  For a custom
serializer, my best recommendation is the same as the docs: look at the
source of one of the existing ones.  And, as always, Google might lead
you to something useful.

Scott Nichol
----- Original Message -----
From: "Mike Kopack" <mk...@isx.com>
To: <so...@xml.apache.org>
Sent: Friday, October 18, 2002 11:19 AM
Subject: Need help creating a custom type mapping


Hey guys,

Ok, I'm pretty lost. I keep looking at vartious documentation but either
they seem to leave out important pieces of the puzzle or they're not
doing things in the same way I am.

First of all, I'm writing a client/server app using Apache SOAP (latest
version) and Java. I'm utilizing the SOAP-RPC method calling
proceedures.

So, on my client side I have something that looks like this:

public String login(SecurityAssertion sa, String clienttype)
 {
  String returnValue  = null;
  try
  {
   Call call                = new Call();
   call.setTargetObjectURI(targetObjectURI);
   call.setMethodName("login");
   call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

   Vector v                 = new Vector(2);
   v.addElement(new Parameter("sa", SecurityAssertion.class, sa, null));
   v.addElement(new Parameter("clienttype", String.class, clienttype,
null));
   call.setParams(v);
   Response r               = call.invoke(url, "");
   if (!r.generatedFault())
   {
    Parameter returnParameter  = r.getReturnValue();
    returnValue = returnParameter.getValue();
   }
   else
   {
    System.out.println("Fault encountered : " +
r.getFault().getFaultString());
   }
  }
  catch (Exception e)
  {
   e.printStackTrace();
  }
  return (String) returnValue;
 }



What I can't seem to figure out is how to create a mapping for how that
"SecurityAssertion" class should be encoded, etc.  I understand that
there is a server side and a client side mechanism that must be done,
but I can't seem to find good CLEAR documentation with a complete step
by step example on how to do this. I've currently got the
SecurityAssertion class setup up as a Javabean, but I'm probably going
to have to make it not one in the future, so some help in how to build
the custom serializer/deserializer would be helpful as well.

Thanks!

--Mike



--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>