Re: Using CXF's Failover Feature

2008-03-13 Thread Daniel Kulp

See:
http://www.nabble.com/Re:-Replica-aware-client-p15469607.html

Dan


On Thursday 13 March 2008, Ayush Gupta wrote:
> I'm trying to use the failover feature. The documentation for this
> seems thin; it is mentioned at
> http://cwiki.apache.org/CXF20DOC/featureslist.html and javadocd at
> http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/clusteri
>ng/pac kage-summary.html
>
>
>
> I understand that I need to enable the failover feature by supplying a
> failover strategy and that at runtime, the getAlternateEndpoints is
> invoked on my selected FailoverStrategy. Here is how I do it in my
> client's cxf.xml:
>
>  class="org.apache.cxf.clustering.SequentialStrategy"/>
>
> 
>
> 
>
>  class="org.apache.cxf.clustering.FailoverFeature">
>
> 
>
> 
>
> 
>
> 
>
> 
>
>
>
> It is not clear to me how and where I need to supply the alternate
> endpoints and if there is anything else I need to do for enabling CXF
> to look at those alternate endpoints if invocations on my webservice
> fail. Has anyone here used CXF's failover?
>
>
>
> -ayush



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Using CXF's Failover Feature

2008-03-13 Thread Ayush Gupta
I'm trying to use the failover feature. The documentation for this seems
thin; it is mentioned at http://cwiki.apache.org/CXF20DOC/featureslist.html
and javadocd at
http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/clustering/pac
kage-summary.html

 

I understand that I need to enable the failover feature by supplying a
failover strategy and that at runtime, the getAlternateEndpoints is invoked
on my selected FailoverStrategy. Here is how I do it in my client's cxf.xml:



















 

It is not clear to me how and where I need to supply the alternate endpoints
and if there is anything else I need to do for enabling CXF to look at those
alternate endpoints if invocations on my webservice fail. Has anyone here
used CXF's failover?

 

-ayush



Re: @XmlJavaTypeAdapter with HashMap creates two fields on SOAP object

2008-03-13 Thread cwilkes

Arg, the problem I had was that my parameters for the XmlAdapter were
reversed.  I now have it as

  public class QueryParametersAdapter extends
XmlAdapter>

and everything works fine.  After I clean this up I'll follow up to this
message with a link to this very simple project.

Thanks for the quick response!

Chris




dkulp wrote:
> 
> 
> If you read the javadoc for the XmlAccessType class, (I just did, I 
> didn't realize this either), even private fields will be grabbed if they 
> have a JAXB annotation on them. 
> 
> Thus, you might want to change to:
> XmlAccessType.FIELD
> to only look at the field.
> 
> Alternatively, take the @XmlJavaTypeAdapter annotation off the field and 
> stick it on the getter.   Thus, the field won't have any jaxb 
> annotations on it.   JAXB SHOULD allow it to work that way.
> 
> Dan
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> [EMAIL PROTECTED]
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%40XmlJavaTypeAdapter-with-HashMap-creates-two-fields-on-SOAP-object-tp16038742p16039193.html
Sent from the cxf-user mailing list archive at Nabble.com.



Re: @XmlJavaTypeAdapter with HashMap creates two fields on SOAP object

2008-03-13 Thread Daniel Kulp

If you read the javadoc for the XmlAccessType class, (I just did, I 
didn't realize this either), even private fields will be grabbed if they 
have a JAXB annotation on them. 

Thus, you might want to change to:
XmlAccessType.FIELD
to only look at the field.

Alternatively, take the @XmlJavaTypeAdapter annotation off the field and 
stick it on the getter.   Thus, the field won't have any jaxb 
annotations on it.   JAXB SHOULD allow it to work that way.

Dan


On Thursday 13 March 2008, cwilkes wrote:
> One of my WebParams has a HashMap in it and so I've annotated the
> field with @XmlJavaTypeAdapter and created an XmlAdapter for it.  The
> java generated from the WSDL has a field that's listed in that Adapter
> along with a "HashMap" that extends "AbstractMap", both in my
> namespace.
>
> The "HashMap" object has getters and setters based on the fieldName
> while the holder object for a List of my Entries is based on the
> method name. That is this class:
>
> @XmlRootElement
> public class AdRequest {
>   @XmlJavaTypeAdapter(QueryParametersAdapter.class)
>   private Map m_queryParameters;
>   public Map getQueryParameters() { ... }
>   public void setQueryParameters(Map
> p_queryParameters) {} }
>
> Turns into this after wsdl2java:
>
> public class AdRequest  implements java.io.Serializable {
> private mynamespace.HashMap m_queryParameters;
> private mynamespace.AdRequestQueryParametersEntry[]
> queryParameters; }
>
> Where mynamespace.HashMap extends mynamespace.AbstractMap.
>
> Marshalling and unmarshalling works fine with my Map
> values added via setQueryParameters(AdRequestQueryParametersEntry[]). 
> I'm just annoyed that this HashMap shows up.
>
> I've tried to annotate with XmlAccessType set to PUBLIC_MEMBER (the
> default) and PROPERTY but it hasn't helped me out.
>
> If I change the field name in my original AdRequest to
> "queryParameters" I get this error in my logs:
>
> Class has two properties of the same name "queryParameters"
>   this problem is related to the following location:
>   at public java.util.Map
> com.ladro.cxf.image.AdRequest.getQueryParameters() at
> com.ladro.cxf.image.AdRequest
>   this problem is related to the following location:
>   at private java.util.Map
> com.ladro.cxf.image.AdRequest.queryParameters at
> com.ladro.cxf.image.AdRequest
>
> which does make sense.
>
> Has anyone else seen this?  I've also tried marking the field as
> XmlTransient but then JAXB ignores the getters and setters.



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


@XmlJavaTypeAdapter with HashMap creates two fields on SOAP object

2008-03-13 Thread cwilkes

One of my WebParams has a HashMap in it and so I've annotated the field with
@XmlJavaTypeAdapter and created an XmlAdapter for it.  The java generated
from the WSDL has a field that's listed in that Adapter along with a
"HashMap" that extends "AbstractMap", both in my namespace.

The "HashMap" object has getters and setters based on the fieldName while
the holder object for a List of my Entries is based on the method name. 
That is this class:

@XmlRootElement
public class AdRequest {
  @XmlJavaTypeAdapter(QueryParametersAdapter.class)
  private Map m_queryParameters;
  public Map getQueryParameters() { ... }
  public void setQueryParameters(Map p_queryParameters) {}
}

Turns into this after wsdl2java:

public class AdRequest  implements java.io.Serializable {
private mynamespace.HashMap m_queryParameters;
private mynamespace.AdRequestQueryParametersEntry[] queryParameters;
}

Where mynamespace.HashMap extends mynamespace.AbstractMap.

Marshalling and unmarshalling works fine with my Map values
added via setQueryParameters(AdRequestQueryParametersEntry[]).  I'm just
annoyed that this HashMap shows up.

I've tried to annotate with XmlAccessType set to PUBLIC_MEMBER (the default)
and PROPERTY but it hasn't helped me out.

If I change the field name in my original AdRequest to "queryParameters" I
get this error in my logs:

Class has two properties of the same name "queryParameters"
this problem is related to the following location:
at public java.util.Map 
com.ladro.cxf.image.AdRequest.getQueryParameters()
at com.ladro.cxf.image.AdRequest
this problem is related to the following location:
at private java.util.Map 
com.ladro.cxf.image.AdRequest.queryParameters
at com.ladro.cxf.image.AdRequest

which does make sense.

Has anyone else seen this?  I've also tried marking the field as
XmlTransient but then JAXB ignores the getters and setters.
-- 
View this message in context: 
http://www.nabble.com/%40XmlJavaTypeAdapter-with-HashMap-creates-two-fields-on-SOAP-object-tp16038742p16038742.html
Sent from the cxf-user mailing list archive at Nabble.com.



wsdl location change from 2.0.4 to 2.0.5

2008-03-13 Thread Daniel Lipofsky
I tried switching from 2.0.4 to 2.0.5-20080311.140539-8,
but I have a problem with WSDLToJava.  In 2.0.4 it generated
*Service.java class with a relative path like "wsdl/Tx.wsdl"
but in 2.0.5 it generates it with an absolute path like
"file:/C:/projects/trunk/bc/ws/template/wsdl/Tx.wsdl"

I tried adding the -wsdlLocation flag, and it fixed the problem
in the @WebServiceClient annotation but not in the URL defined
in the static block of the service class, which looks like this

static {
URL url = null;
try {
url = new
URL("file:/C:/projects/trunk/bc/ws/template/wsdl/Tx.wsdl");
} catch (MalformedURLException e) {
System.err.println("Can not initialize the default wsdl from
file:/C:/projects/trunk/bc/ws/template/wsdl/Tx.wsdl");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}

So is this a bug in wsdl2java in 2.0.5?
If not is there a way around it?

I also get this when I startup JBoss 4.2.2 with 2.0.5.
Do I need to worry about this?  What does this mean?

...
2008-03-13 13:58:10,260 ERROR [STDERR] - Mar 13, 2008 1:58:10 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://www.foobar.com/Tx}TxService from WSDL:
wsdl/Tx.wsdl
2008-03-13 13:58:10,432 ERROR [STDERR] - Mar 13, 2008 1:58:10 PM
org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /Tx
2008-03-13 13:58:10,432 ERROR [STDERR] - Mar 13, 2008 1:58:10 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://www.foobar.com/WorkOrder}WorkOrderService
from WSDL: wsdl/WorkOrder.wsdl
2008-03-13 13:58:10,682 ERROR [STDERR] - Mar 13, 2008 1:58:10 PM
org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /WorkOrder
...

Thanks,
Dan


Re: Exception in INOUT parameter

2008-03-13 Thread Daniel Kulp

Well, the first error is due to a bug in XmlSchema that we're TRYING to 
get a fix from them for:
https://issues.apache.org/jira/browse/CXF-1388

That team hasn't been to responsive with getting us a fix though.  If you 
would like to bug [EMAIL PROTECTED] about it, that would be 
great.   The fix is in place, we just need a release from them.   


A test case for the second would be good.


Dan



On Thursday 13 March 2008, GianCarlo wrote:
> Hi,
>
> I need to expose a service with CXF with an INOUT parameter. The INOUT
> parameter is array of objects (of class NameAndValue_T).
>
> The interface exposed is:
>
> package foo;
>
> import javax.jws.WebParam;
> import javax.jws.WebParam.Mode;
>
>
> @javax.jws.WebService(name="ENDPOINT_NAME",
>  
> targetNamespace="NAME_SPACE")@javax.jws.soap.SOAPBinding(use=javax.jws
>.soap.SOAPBinding.Use.LITERAL,
> parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)
>
> public abstract interface TestInterface {
>
> @javax.jws.WebMethod(operationName="bar")
> abstract public boolean bar(@WebParam(name="how_many") int
> how_many, @WebParam(name="nameList", mode=Mode.INOUT) 
> javax.xml.ws.Holder nameList);
>
> }
>
> During the Service creation the following Exception is raised:
>
> INFO: Creating Service {NAME_SPACE}TestInterfaceService from class
> foo.TestInterface Exception in thread "main"
> org.apache.ws.commons.schema.constants.Enum$EnumValueException: Bad
> Enumeration value 'extension restriction' at
> org.apache.ws.commons.schema.constants.Enum.setValue(Enum.java:49) at
> org.apache.ws.commons.schema.constants.Enum.(Enum.java:27) at
> org.apache.ws.commons.schema.XmlSchemaDerivationMethod.(XmlSchem
>aDerivationMethod.java:46) at
> org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBui
>lder.java:657) at
> org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(Sche
>maBuilder.java:157) at
> org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82
>) at
> org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollect
>ion.java:342) at
> org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection
>.java:111) at
> org.apache.cxf.databinding.source.AbstractDataBinding.addSchemaDocumen
>t(AbstractDataBinding.java:72) at
> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:26
>5) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi
>ceFromClass(ReflectionServiceFactoryBean.java:313) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize
>ServiceModel(ReflectionServiceFactoryBean.java:362) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Ref
>lectionServiceFactoryBean.java:156) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServi
>ceFactoryBean.java:89) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoin
>t(AbstractWSDLBasedEndpointFactory.java:74) at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.jav
>a:108) at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryB
>ean.java:147) at foo.Server.(Server.java:41)
>   at foo.Server.main(Server.java:46)
>
>
> Moreover if add try to use a two dimensial array as INOUT parameter i
> have a (different) exception: (...same as the other...)
> public abstract interface TestInterface {
>
> @javax.jws.WebMethod(operationName="bar")
> abstract public boolean bar(@WebParam(name="how_many") int
> how_many, @WebParam(name="nameList", mode=Mode.INOUT) 
> javax.xml.ws.Holder nameList);
>
> }
>
>
> The exception is
>
> INFO: Creating Service {NAME_SPACE}TestInterfaceService from class
> foo.TestInterface Exception in thread "main"
> java.lang.ClassCastException:
> sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be
> cast to java.lang.Class at
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getHolderClass(
>JaxWsServiceConfiguration.java:707) at
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getHolderType(J
>axWsServiceConfiguration.java:697) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getHolderT
>ype(ReflectionServiceFactoryBean.java:1423) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize
>Parameter(ReflectionServiceFactoryBean.java:1325) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createMess
>ageParts(ReflectionServiceFactoryBean.java:1156) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createOper
>ation(ReflectionServiceFactoryBean.java:699) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createInte
>rface(ReflectionServiceFactoryBean.java:683) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi
>ceFromClass(ReflectionServiceFactoryBean.java:305) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize
>ServiceModel(ReflectionServiceFactoryBean.java:362) at
> org.apache.cxf.service.

Re: Jaxb Complex type

2008-03-13 Thread mateamargo



mateamargo wrote:
> 
> Did you ever get a java.lang.TypeNotPresentException running
> java2wsdl?
> I'm having this issue with a complex type
> 

Nevermind, I found the problem.
I was running the Maven plugin manually, I had to bind it to the package
phase.
-- 
View this message in context: 
http://www.nabble.com/Jaxb-Complex-type-tp12150941p16025517.html
Sent from the cxf-user mailing list archive at Nabble.com.



Exception in INOUT parameter

2008-03-13 Thread GianCarlo
Hi,

I need to expose a service with CXF with an INOUT parameter. The INOUT 
parameter is array of objects (of class NameAndValue_T).

The interface exposed is:

package foo;

import javax.jws.WebParam;
import javax.jws.WebParam.Mode;


@javax.jws.WebService(name="ENDPOINT_NAME",
  
targetNamespace="NAME_SPACE")@javax.jws.soap.SOAPBinding(use=javax.jws.soap.SOAPBinding.Use.LITERAL,
  
parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)

public abstract interface TestInterface {

@javax.jws.WebMethod(operationName="bar")
abstract public boolean bar(@WebParam(name="how_many") int how_many, 
@WebParam(name="nameList", mode=Mode.INOUT)  
javax.xml.ws.Holder nameList);

}

During the Service creation the following Exception is raised:

INFO: Creating Service {NAME_SPACE}TestInterfaceService from class 
foo.TestInterface
Exception in thread "main" 
org.apache.ws.commons.schema.constants.Enum$EnumValueException: Bad Enumeration 
value 'extension restriction'
at org.apache.ws.commons.schema.constants.Enum.setValue(Enum.java:49)
at org.apache.ws.commons.schema.constants.Enum.(Enum.java:27)
at 
org.apache.ws.commons.schema.XmlSchemaDerivationMethod.(XmlSchemaDerivationMethod.java:46)
at 
org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBuilder.java:657)
at 
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:157)
at 
org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:342)
at 
org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:111)
at 
org.apache.cxf.databinding.source.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:72)
at 
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:265)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:313)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:362)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:156)
at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:89)
at 
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74)
at 
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108)
at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147)
at foo.Server.(Server.java:41)
at foo.Server.main(Server.java:46)


Moreover if add try to use a two dimensial array as INOUT parameter i have a 
(different) exception:
(...same as the other...)
public abstract interface TestInterface {

@javax.jws.WebMethod(operationName="bar")
abstract public boolean bar(@WebParam(name="how_many") int how_many, 
@WebParam(name="nameList", mode=Mode.INOUT)  
javax.xml.ws.Holder nameList);

}


The exception is

INFO: Creating Service {NAME_SPACE}TestInterfaceService from class 
foo.TestInterface
Exception in thread "main" java.lang.ClassCastException: 
sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be cast to 
java.lang.Class
at 
org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getHolderClass(JaxWsServiceConfiguration.java:707)
at 
org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getHolderType(JaxWsServiceConfiguration.java:697)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getHolderType(ReflectionServiceFactoryBean.java:1423)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeParameter(ReflectionServiceFactoryBean.java:1325)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createMessageParts(ReflectionServiceFactoryBean.java:1156)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createOperation(ReflectionServiceFactoryBean.java:699)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createInterface(ReflectionServiceFactoryBean.java:683)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:305)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:362)
at 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:156)
at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:89)
at 
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74)
at 
org.apache.cxf.frontend.Server

Re: Jaxb Complex type

2008-03-13 Thread mateamargo

Did you ever get a java.lang.TypeNotPresentException running java2wsdl?

I'm having this issue with a complex type
-- 
View this message in context: 
http://www.nabble.com/Jaxb-Complex-type-tp12150941p16025206.html
Sent from the cxf-user mailing list archive at Nabble.com.