Re: WSDL2Java and package structure

2005-08-29 Thread Thad Humphries
Thanks, Chris, that worked.  The part you have to escape is the colon (:) in 
the URL:

http\://www.mycorp.com/wsdl/MyServices.wsdl=com.mycorp.services

I've also figured out that using Ant, I can add the  parameter to the 
 

http://www.mycorp.com/wsdl/MyServices.wsdl";
package="com.mycorp.services"/>

On Monday 29 August 2005 15:56, Ebert, Chris wrote:
> You can remap packages with a mapping file. I had a little trouble with
> the format -- the documentation was either confusing or wrong and I
> needed to escape some characters in my uri, but
> =
> Works for me. There's a property you can set for WSDL2Java (ant task or
> command line) to specify a package mapping file.
>
> Chris
>
>
> -Original Message-
> From: Thad Humphries [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 29, 2005 12:29
> To: axis-user@ws.apache.org
> Subject: WSDL2Java and package structure
>
> Is the package structure created when running WSDL2Java entirely at the
> mercy of the value of the targetNamespace attribute in the definitions
> tag?  If targetNamespace is (for example)
> http://www.mycorp.com/wsdl/MyServices.wsdl,
> the package structure for the binding and service  becomes
> com.mycorp.www.wsdl.MyServices_wsdl.  Meanwhile, along with
>
> http://localhost:8080/axis/services/MyProduct"/>
>
>
> in the  part of the WSDL file, I get the file
> com/mycorp/services.java
>
> Is there any way to change the class structure generated by WSDL2Java?

-- 
Thad Humphries "...no religious test shall ever be required
Web Development Manager as a qualification to any office or public
Phone: 540/675-3015, x225   trust under the United States." -Article VI


WSDL2Java and package structure

2005-08-29 Thread Thad Humphries
Is the package structure created when running WSDL2Java entirely at the mercy 
of the value of the targetNamespace attribute in the definitions tag?  If 
targetNamespace is (for example) http://www.mycorp.com/wsdl/MyServices.wsdl, 
the package structure for the binding and service  becomes 
com.mycorp.www.wsdl.MyServices_wsdl.  Meanwhile, along with

http://localhost:8080/axis/services/MyProduct"/> 

in the  part of the WSDL file, I get the file 
com/mycorp/services.java

Is there any way to change the class structure generated by WSDL2Java?


Re: WS examples for handling modestly complex input parameters and return types

2005-08-18 Thread Thad Humphries
Don,

I've been playing a lot with custom serialization lately.  I'll provide below 
an example of a service returning an array of a custom class.  The example 
was built in Axis 1.2.1 and JDK 1.5.0_02.  

I'm assuming you know how to handle the (de)serialization of the custom class.  
If not, query this list as I put some examples of this up in the last week or 
two.

My service has this method (simplified)

  public CheckOutRec[] checkOutList() 
  {
CheckOutRec [] ckoutArr = ... call to legacy system returning array
return ckoutArr;
  }

My client code looks like

  void checkOutList (
  Callcall ) 
throws Exception 
  {
try
{
  call.setOperationName( "checkOutList" );

  // Register my custom class (de)serializers
  call.registerTypeMapping( CheckOutRec.class,
  OASQNames.checkOutRecQName,
  CheckOutRecSerFactory.class,
  CheckOutRecDeserFactory.class );

  // Register array (de)serializers; note different QName
  // from above.
  ArraySerializerFactory asf = 
  new ArraySerializerFactory(CheckOutRec.class, 
OASQNames.checkOutRecQName); 
  ArrayDeserializerFactory adf = 
  new ArrayDeserializerFactory(OASQNames.checkOutRecQName);
  call.registerTypeMapping( CheckOutRec[].class, 
  OASQNames.checkOutRecArrQName,
  asf.getClass(),
  adf.getClass() );

  // Set return type; note QName used in array 
  // registration above
  call.setReturnType( OASQNames.checkOutRecArrQName );

  CheckOutRec [] ret = (CheckOutRec []) call.invoke( 
  new Object[] {} );
  if ( ret == null ) 
  {
  System.out.println( "Received null" );
  }
  else
  {
  System.out.println( "checkOutList:" );
  for ( int i = 0; i < ret.length; i++ )
  {
  System.out.println( " - objectName: " + ret[i].objectName );
  }
  }

  call.removeAllParameters();
}
catch ( RemoteException e )
{
System.err.println( "Caught RemoteException: " + e.getMessage() );
}
  }

In my deploy.wsdd, I've type mapped only my custom type, not the array:

  http://schemas.xmlsoap.org/soap/encoding/"/>

Let me know if this helps.  It's my intent to write up what I've learned about 
custom serialization for the User's Manual so any input is valuable.

On Wednesday 17 August 2005 15:57, Chen, Donald wrote:
> I am a newbie of Axis and looking for code examples of WS(both service
> and client) which has input parameters like array and/or hash, and
> return types like array/hash.  
> 
> I found no such samples included in the Axis release.
> 
> Any type clue(such as a URL) will be appreciated!


Re: deserialzing an array in a complex type

2005-08-12 Thread Thad Humphries
Success!

I found that on my deserializer side, it is a two stop process:  One must 
register the deserializer for the class in the array and for the array 
itself.  Oddly, this does not appear necessary on the serializer side:  TCP 
Monitor shows the same soapenv:Envelope regardless.  So, in my serialzer's 
serialize() method, I have

  TypeMappingRegistry reg = context.getTypeMappingRegistry();
  TypeMapping tm = (TypeMapping)   
   reg.getOrMakeTypeMapping(Constants.URI_SOAP11_ENC);
  tm.register( ACLRec.class, OASQNames.aclRecQName,
   new ArraySerializerFactory(ACLRec.class, OASQNames.aclRecQName),
   new ArrayDeserializerFactory(OASQNames.aclRecQName));

while in my deserializer I have

  TypeMappingRegistry reg = context.getTypeMappingRegistry();
  TypeMapping tm = (TypeMapping)   
   reg.getOrMakeTypeMapping(Constants.URI_SOAP11_ENC);
  tm.register( ACLRec.class, OASQNames.aclRecQName, 
   new ACLRecSerFactory(), new ACLRecDeserFactory() );
  tm.register( ACLRec[].class, OASQNames.aclRecArrQName,
   new ArraySerializerFactory(ACLRec.class, OASQNames.aclRecQName),
   new ArrayDeserializerFactory(OASQNames.aclRecQName));

I believe this is because ArrayDeserializerFactory initializes only with a 
QName, not a class and QName.  Why not?  Is that an oversight in the API?

On Friday 12 August 2005 16:34, Thad Humphries wrote:
> I'm having trouble deserializing a class that includes an array member.


deserialzing an array in a complex type

2005-08-12 Thread Thad Humphries
I'm having trouble deserializing a class that includes an array member.

I have two class that look like

public class ACLRec {
  public intaclID;
  public String  aclName;
}

public class ACLList {
  public ACLRec  []acls;
  public int  defaultACL;
}

Using TCP Monitor, the response seems okay (see below) but I'm getting an 
exception when I try to deserialize the response:

java.lang.IllegalArgumentException
  at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
  at java.lang.reflect.Field.set(Field.java:656)
  at org.apache.axis.encoding.FieldTarget.set(FieldTarget.java:52)
  at 
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
...

The problem seems that FieldTarget.set is looking for an object in the 'acls' 
field but seeing an array.  How do I properly register my array?  Right now 
I'm using:

  typesByMemberName.put( aclsMember,   OASQNames.aclRecQName );
  ...
  // Map (de)serializers for internal types here.
  TypeMappingRegistry reg = context.getTypeMappingRegistry();
  TypeMapping tm = (TypeMapping) 
reg.getOrMakeTypeMapping(Constants.URI_SOAP11_ENC);
  tm.register( ACLRec.class, OASQNames.aclRecQName,
new org.apache.axis.encoding.ser.ArraySerializerFactory(ACLRec.class,
OASQNames.aclRecQName),
new 
org.apache.axis.encoding.ser.ArrayDeserializerFactory(OASQNames.aclRecQName));  
  

  Deserializer dSer = context.getDeserializerForType( typeQName );
  try 
  {
  dSer.registerValueTarget( new FieldTarget(value, localName) );

This is the same as my serialization which is working.

Any ideas?

Axis Response:

http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   
  http://schemas.xmlsoap.org/soap/encoding/";>
 
  
  http://schemas.xmlsoap.org/soap/encoding/"; 
xsi:type="ns1:oasSoapNamespace" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:ns1="urn:oasSoapNamespace">
 


 
 0
  
  http://schemas.xmlsoap.org/soap/encoding/"; 
xsi:type="ns3:ACLRec" xmlns:ns3="oasSoapNamespace" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>
 1
 Example ACL
  
  http://schemas.xmlsoap.org/soap/encoding/"; 
xsi:type="ns4:ACLRec" xmlns:ns4="oasSoapNamespace" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>
 0
 Disable ACLs
  
   



Re: Problem: Reload Axis with the Tomcat Manager

2005-08-11 Thread Thad Humphries
I am running Tomcat 5.5.9 on Linux (Suse 9.2) with JDK 1.5.0_02.  The Tomcat 
Manager's reload works fine for me.

On Thursday 11 August 2005 07:58, Grimm Bernd wrote:
> I want to reload the axis application without restarting tomcat.
> To do this, I use the tomcat manager.


Re: Problems undeploying a service and with SOAPMonitor

2005-08-10 Thread Thad Humphries
Juan,

What does your undeploy.wsdd look like?  The ones in the samples directory 
that I've looked at are like

  http://xml.apache.org/axis/wsdd/";>

  

I use this ant script:

  

  
  


  

  

Perhaps there are additional parts to  but I don't know them.

On Wednesday 10 August 2005 12:38, Juan Cervera wrote:
> Thanks for the suggestion Thad,
>
> I've tried to undeploy and deploy the Axis WAR and even bouncing WAS,
> but still have the same problem, so it does not look that the problem is
> produced by "hung" processes in my case. The only way I have managed to
> undeploy services is by manually modifying the server-config.wsdd.
>
> Does anyone have more suggestions on this problem?


Re: Problems undeploying a service and with SOAPMonitor

2005-08-10 Thread Thad Humphries
I occassionally have a service that won't undeploy, usually just after 
clicking the 'List' option (that runs 
localhost:8080/axis/servlet/AxisServlet) or when one of my services erred and 
didn't finish properly.  I use Tomcat 5.5.9.  Reloading the axis application 
via the Tomcat Manager clears up whatever is hung out there and I can then 
undeploy my service.

On Tuesday 09 August 2005 05:29, Juan Cervera wrote:
> Does anybody know why I get the following error when I try to undeploy
> my services? I'm using Axis 1.2.1 final on WAS 5.0.2.12


Re: stumped on deserializer problem

2005-08-08 Thread Thad Humphries
Bingo!  I've cracked the custom (de)serialization for my classes.  Moreover, 
I've managed to figure out custom (de)serialization for a class when it 
contains members that also require custom (de)serialization.  

The later case was difficult because the exception I was getting in my 
real-world problem didn't point to the source of the error.  To solve this, I 
created a simplified set of classes and (de)serializer.  This pointed me 
straight to the problem.  I intend to write the axis-dev folks and offer a 
write-up and my example for the user's manual.

On Thursday 04 August 2005 16:37, [EMAIL PROTECTED] wrote:
> I didn't see any answers to your question, so I'll add what I know, having
> just run into the same exception myself.  When I went to add the
> typeMapping into my .wsdd file, I found that adding the element qname
> didn't resolve anything--what I needed to do, was add the _complexType_
> qname.


Re: Happyaxis reports problems loading libraries, found but with problems

2005-08-05 Thread Thad Humphries
I have almost the problem as Jonathan.  I'm running Tomcat 5.5.9 with Java 1.5 
on Linux.  My message reads:

See http://xml.apache.org/security/ {4}
The root cause was: org/apache/commons/logging/LogFactory

This happens whether I put xmlsec-1.2.1.jar in $CATALINA_HOME/common/lib or 
$CATALINA_HOME/common/endorsed.  When I put xmlsec-1.2.1.jar in 
$CATALINA_HOME/webapps/axis/WEB-INF/lib, the message was

See http://xml.apache.org/security/ {4}
The root cause was: {0}

What does this mean?  Should I be using an older version of xmlsec-1.2.1.jar?

On Friday 05 August 2005 09:58, Javier Gonzalez wrote:
> Where are xmlsec.jar and activation.jar located? (the hint that the
> error message told you)
>
> IIRC, in Tomcat the classloaders are ordered like this: webapp ->
> shared -> common -> system. The classloaders can look in that order
> and not in the reverse order. That is, if A.jar is on the webapp lib
> dir, B.jar is in shared/lib, and A depends on B, it's ok, since the
> webapp classloader can ask the next classloader for B. But if B
> depends on A, then you'll have an error because the shared classloader
> can't look "back" into the webapp classloader.
>
> On 8/5/05, Jonathan J. Vargas R. <[EMAIL PROTECTED]> wrote:
> > Greets,
> >
> > I tried to install xmlsec into axis, but seems axis has problems doing
> > this. The problem is with xmlsec, but I still don't know how to solve
> > it or fix it. I am using tomcat, This is the happyaxis report:
> >
> >
> > Optional Components
> >
> >
> > Warning: could not find a dependency of class
> > org.apache.xml.security.Init from file xmlsec.jar
> > XML Security is not supported
> > See http://xml.apache.org/security/
> > The root cause was: org/apache/xpath/compiler/FuncLoader
> > This can happen e.g. if org.apache.xml.security.Init is in the
> > 'common' classpath, but a dependency like activation.jar is only in
> > the webapp classpath.
> >
> > Found Java Secure Socket Extension (javax.net.ssl.SSLSocketFactory) at
> > an unknown location


stumped on deserializer problem

2005-08-02 Thread Thad Humphries
I've been through the archives and seen numerous references to this same 
problem.  No suggestions have helped or clarified any of this for me.  
(Judging from the frequency of this question, most other folks are stumped, 
too.)  Can someone clear this up?  I promise to write this up for the Axis 
docs if I ever getting it figured out.  Maybe that will close this thread.

Recently I've read to start/restart Tomcat (I'm using TC 5.5.9) but that 
hasn't worked.  I'm using Axis 1.2.1.

I have a large set of Java classes that talk to a Sun RPC legacy application.  
I want to access the legacy app via SOAP.  The Java classes were written 
without much (if any) thought to Beans (the Java API was to mimic the C/C++ 
API as closely as possible).  Hence BeanSerialization is not appropriate 
(methods like isFoo() or getFoo() often do not have an underlying foo 
member).  With the user's guide to custom serialization TBD, I have been 
using samples/encoding and Google finds as a guide.  When I adapt 
samples/encoding/TestSer.java to test my class, it works perfectly but when I 
try to call client-server via Axis, I get the exception:

"Caught RemoteException: org.xml.sax.SAXException: Deserializing parameter 
'pObjectID':  could not find deserializer for type 
{urn:oasSoapNamespace}ObjectID"

Here (in summary) are my files classes:

// deploy.wsdd
http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
  




  http://schemas.xmlsoap.org/soap/encoding/"/>
  http://schemas.xmlsoap.org/soap/encoding/"/>

  


// The server application, OASService.java
public class OASService 
{
OAS oas;
public String getFileObjectPathname ( ObjectID pObjectID ) {
try {
return oas.getFileObjectPathname( pObjectID );
} catch ( OptixException e ) {
return e.getMessage();
}
}
}

// OASQNames.java
public interface OASQNames
{
public static final QName objectIDQName = new 
QName( "urn:oasSoapNamespace", "ObjectID" );
public static final QName osTypeQName   = new 
QName( "urn:oasSoapNamespace", "OSType" );
}

// ObjectIDSer.java
public class ObjectIDSer implements Serializer, OASQNames
{
public static final String hostNumberMember = "hostNumber";
public static final String typeIDMember = "typeID";
public static final String objectNumberMember   = "objectNumber";
public static final String revisionNumberMember = "revisionNumber";

public void serialize ( QName name, Attributes attributes, Object value, 
SerializationContext context )
throws IOException
{
if (!(value instanceof ObjectID))
throw new IOException( "Can't serialize a " + 
value.getClass().getName() + " with ObjectIDSer.");
ObjectID objID = (ObjectID)value;

context.startElement( name, attributes );
context.serialize( new QName("", hostNumberMember), null, new 
Integer(objID.hostNumber) );

TypeMappingRegistry reg = context.getTypeMappingRegistry();
TypeMapping tm = (TypeMapping) 
reg.getOrMakeTypeMapping(Constants.URI_SOAP11_ENC);
tm.register( OSType.class, osTypeQName, 
new OSTypeSerFactory(), new OSTypeDeserFactory() );
context.serialize( new QName("", typeIDMember), null, objID.typeID );

context.serialize( new QName("", objectNumberMember), null, new 
Integer(objID.objectNumber) );
context.serialize( new QName("", revisionNumberMember), null, new 
Integer(objID.revisionNumber) );
context.endElement();
}
...
}

// ObjectIDDeser.java
public class ObjectIDDeser extends DeserializerImpl implements OASQNames
{
public static final String hostNumberMember = "hostNumber";
public static final String typeIDMember = "typeID";
public static final String objectNumberMember   = "objectNumber";
public static final String revisionNumberMember = "revisionNumber";

private Hashtable typesByMemberName = new Hashtable();  

public ObjectIDDeser()
{
typesByMemberName.put( hostNumberMember, Constants.XSD_INT );
typesByMemberName.put( typeIDMember, osTypeQName );
typesByMemberName.put( objectNumberMember,   Constants.XSD_INT );
typesByMemberName.put( revisionNumberMember, Constants.XSD_INT );
value = new ObjectID();
}

public SOAPHandler onStartChild ( String namespace, String localName,
String prefix, Attributes attributes, DeserializationContext context )
throws SAXException
{
QName typeQName = (QName)typesByMemberName.get(localName);
if ( typeQName == null )
throw new SAXException( "Invalid element in ObjectID struct - " + 
localName );

// These can come in either order.
Deserializer dSer = context.getDeserializerForType( typeQName );
try {
dSer.registerValueTarget( new FieldTarget(value, localNam