Re: How to change the namespace position in the generate xml message (SOAP message)?

2008-03-21 Thread Yuval Zou

Hi Ian,

I have tried your solution but it seems not work as expected. I'm a beginner
of CXF and I'm not sure my implementation is correct. Could you please take
a look at it?
1. I created cxf.xml on the client side:
beans xmlns=http://www.springframework.org/schema/beans;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xmlns:jaxws=http://cxf.apache.org/jaxws;
  xmlns:soap=http://cxf.apache.org/bindings/soap;
  xsi:schemaLocation=
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd;
  jaxws:client id=cmwebserviceClient 
serviceClass=cm.webservices.CMWebServicePortType
address=http://localhost/CMBSpecificWebService/services/CMWebService;
jaxws:dataBinding
 bean class=org.apache.cxf.jaxb.JAXBDataBinding
   property name=marshallerProperties
 map
   entry key=com.sun.xml.bind.namespacePrefixMapper
 bean class=common.webservices.NoNamespacePrefixMapper /
   /entry
 /map
   /property
   property name=namespaceMap
map
entry 
key=http://www.ibm.com/xmlns/db2/cm/api/1.0/schema;
valuecm/value
/entry
entry 
key=http://www.ibm.com/xmlns/db2/cm/beans/1.0/schema;
valuecmb/value
/entry
/map
/property
 /bean
   /jaxws:dataBinding
/jaxws:client 
/beans
property name=namespaceMap is insignificant. If it is removed, the
result is same.

2. Implemented the NoNamespacePrefixMapper:
public class NoNamespacePrefixMapper extends
com.sun.xml.bind.marshaller.NamespacePrefixMapper {

@Override
public String getPreferredPrefix(String arg0, String arg1, boolean 
arg2) {
return ;
}

}

3. Get service:
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[]{cxf.xml});
return (CMWebServicePortType)context.getBean(cmwebserviceClient);

4. Invoke the service operation. The xml message is still as before.

Is there anything wrong in these steps? Thanks!


ianroberts wrote:
 
 Yuval Zou wrote:
 Hi,
 
 Recently, I'm working on a web services client using CXF. But some
 request
 messages can't be parsed by the web services server. I found the problem
 is
 related to the namespace and prefix.
 The correct message:
 ?xml version=1.0 encoding=UTF-8?
 CreateItemRequest
 xmlns=http://www.ibm.com/xmlns/db2/cm/beans/1.0/schema;
   [snip]
 /CreateItemRequest
 The namespace http://www.ibm.com/xmlns/db2/cm/api/1.0/schema was put in
 the
 element that needs it in this correct message.
 
 The mesage can't be parsed by server (sent by CXF):
 ?xml version=1.0 encoding=UTF-8?
 CreateItemRequest
 xmlns:ns2=http://www.ibm.com/xmlns/db2/cm/api/1.0/schema;
 xmlns=http://www.ibm.com/xmlns/db2/cm/beans/1.0/schema;
   [snip]
 /CreateItemRequest
 
 The namespace http://www.ibm.com/xmlns/db2/cm/api/1.0/schema was put in
 the
 root element.
 
 In XML terms the two messages are exactly the same, so it's more the 
 fault of whatever is parsing the message on the server side rather than 
 of the XML generator in CXF.  Nontheless...
 
 If you're using JAXB databinding then you may be able to do what you 
 want using a custom namespace prefix mapper in the data binding. 
 Something like this (not tested but you get the idea):
 
 jaxws:client ...
jaxws:dataBinding
  bean class=org.apache.cxf.jaxb.JAXBDataBinding
property name=marshallerProperties
  map
entry key=com.sun.xml.bind.namespacePrefixMapper
  bean class=my.package.NoPrefixNamespaceMapper /
/entry
  /map
/property
  /bean
/jaxws:dataBinding
 /jaxws:client
 
 Where NoPrefixNamespaceMapper is an implementation of 
 com.sun.xml.bind.marshaller.NamespacePrefixMapper whose 
 getPreferredPrefix method always returns .  This should force the 
 marshaller to only use prefixes when it absolutely has to.
 
 Ian
 
 -- 
 Ian Roberts   | Department of Computer Science
 [EMAIL PROTECTED]  | University of Sheffield, UK
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-change-the-namespace-position-in-the-generate-xml-message-%28SOAP-message%29--tp16176819p16194418.html
Sent from the cxf-user mailing list archive at Nabble.com.



Re: How to change the namespace position in the generate xml message (SOAP message)?

2008-03-21 Thread Yuval Zou

Hi Dan,

I have tried the second option. I modified the codes as you suggested. It
works but the attachment data are still embeded in the cached stream. So the
performance of the transformation is terrible. The code looks like below,
could you please help to find if there is something wrong and how can I fix
it? Thank you very much!

public class StreamInterceptor extends AbstractPhaseInterceptor {

private StreamEndingInterceptor ending = new StreamEndingInterceptor();
public static final String ORIGINAL_OUTPUT = original_output; 

public StreamInterceptor() {
super(Phase.PRE_STREAM);
addBefore(AttachmentOutInterceptor.class.getName());
}

public void handleMessage(Message message) {
OutputStream os = message.getContent(OutputStream.class);
message.put(ORIGINAL_OUTPUT, os);
CachedStream cs = new CachedStream();
message.setContent(OutputStream.class, cs);

//  message.getInterceptorChain().doIntercept(message);
try {
cs.flush();
} catch (IOException e) {
e.printStackTrace();
}
message.getInterceptorChain().add(ending);
}

public void handleFault(Message message) {
}

public class StreamEndingInterceptor extends AbstractPhaseInterceptor {

public StreamEndingInterceptor() {
super(Phase.PRE_STREAM_ENDING);

addAfter(AttachmentOutInterceptor.AttachmentOutEndingInterceptor.class.getName());
 
}

public void handleMessage(Message message) {
try {
CachedOutputStream csnew = (CachedOutputStream)
message.getContent(OutputStream.class);
OutputStream os = (OutputStream) 
message.get(ORIGINAL_OUTPUT);

StringBuilder sb = new StringBuilder();
csnew.writeCacheTo(sb);

String tmpXML = sb.toString();
System.out.println(#OLD# + tmpXML);
while (tmpXML.indexOf(ns2:)!=-1){
String subTmp = 
tmpXML.substring(tmpXML.indexOf(ns2:));
subTmp = subTmp.substring(1, subTmp.indexOf( ));
tmpXML = tmpXML.replaceAll(subTmp, 
subTmp.substring(4) +   +
xmlns=\http://www.ibm.com/xmlns/db2/cm/api/1.0/schema\; );
System.out.println(#FIXED# + tmpXML);
}   

InputStream in = new 
ByteArrayInputStream(tmpXML.getBytes());   
BufferedOutputStream bos = new BufferedOutputStream(os);
CachedOutputStream.copyStream(in, bos, 1024);

csnew.close();
in.close();
bos.close();
os.flush();

//  message.setContent(OutputStream.class, os);
} catch (IOException e) {
e.printStackTrace();
}
}

}

private class CachedStream extends CachedOutputStream {

public CachedStream() {
super();
}

protected void doFlush() throws IOException {
currentStream.flush();
}

protected void doClose() throws IOException {
}

protected void onWrite() throws IOException {
}

}
}

Yuval
 

dkulp wrote:
 
 
 This is definitely a bug for whomever is consuming that message.   
 According to the XML rules, both messages are equivilent.
 
 Couple options:
 
 1) Best performing option:  write an interceptor that would be 
 immediately AFTER the StaxOutInterceptor that would take the 
 XMLStreamWriter and replace it with a new XMLStreamWriter that wrappers 
 the original, but overwrides the start element and namespace map stuff 
 so that it generates empty prefixes at all times.  That StreamWriter 
 might be a bit tricky to write if you aren't familliar with StAX, but it 
 would definitely be the best performing as you wouln't break the 
 streaming, you wouldn't need to scan the byte[], etc  FYI: your 
 interceptor will also need to set:
 msg.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION,
 Boolean.TRUE);
 to make sure it actually uses the new StreamWriter in all cases.
 
 
 2) Next option: your CachedOutputStream stuff.   This actually will 
 work, but you need to modify things a bit.  First off, it needs to be 
 split into two interceptors: (usually, it's one interceptor.java that 
 then has an inner class for the other.  See the AttachmentOutInterceptor 
 for example)
a) First/Outer one will replace the OutputStream with the 

Re: How to change the namespace position in the generate xml message (SOAP message)?

2008-03-21 Thread Daniel Kulp
On Friday 21 March 2008, Yuval Zou wrote:
 Hi Dan,

 I have tried the second option. I modified the codes as you suggested.
 It works but the attachment data are still embeded in the cached
 stream. So the performance of the transformation is terrible. The code
 looks like below, could you please help to find if there is something
 wrong and how can I fix it? Thank you very much!

Try moving the interceptors inside the bounds of the 
AttachmentOutInterceptors:

First interceptor:
addAfter(AttachmentOutInterceptor.class.getName());

Second interceptor:
addBefore(AttachmentOutInterceptor.AttachmentOutEndingInterceptor.class.getName());

That should do the trick and only give you the root part.


Dan





 public class StreamInterceptor extends AbstractPhaseInterceptor {

   private StreamEndingInterceptor ending = new
 StreamEndingInterceptor(); public static final String ORIGINAL_OUTPUT
 = original_output;

 public StreamInterceptor() {
 super(Phase.PRE_STREAM);
 addBefore(AttachmentOutInterceptor.class.getName());
 }

 public void handleMessage(Message message) {
   OutputStream os = message.getContent(OutputStream.class);
   message.put(ORIGINAL_OUTPUT, os);
   CachedStream cs = new CachedStream();
 message.setContent(OutputStream.class, cs);

 //message.getInterceptorChain().doIntercept(message);
   try {
   cs.flush();
   } catch (IOException e) {
   e.printStackTrace();
   }
 message.getInterceptorChain().add(ending);
 }

 public void handleFault(Message message) {
 }

 public class StreamEndingInterceptor extends
 AbstractPhaseInterceptor {

   public StreamEndingInterceptor() {
   super(Phase.PRE_STREAM_ENDING);

 addAfter(AttachmentOutInterceptor.AttachmentOutEndingInterceptor.class
.getName()); }

   public void handleMessage(Message message) {
   try {
   CachedOutputStream csnew = (CachedOutputStream)
 message.getContent(OutputStream.class);
   OutputStream os = (OutputStream) 
 message.get(ORIGINAL_OUTPUT);

   StringBuilder sb = new StringBuilder();
   csnew.writeCacheTo(sb);

   String tmpXML = sb.toString();
   System.out.println(#OLD# + tmpXML);
   while (tmpXML.indexOf(ns2:)!=-1){
   String subTmp =
 tmpXML.substring(tmpXML.indexOf(ns2:)); subTmp =
 subTmp.substring(1, subTmp.indexOf( )); tmpXML =
 tmpXML.replaceAll(subTmp, subTmp.substring(4) +   +
 xmlns=\http://www.ibm.com/xmlns/db2/cm/api/1.0/schema\; );
 System.out.println(#FIXED# + tmpXML); }

   InputStream in = new
 ByteArrayInputStream(tmpXML.getBytes()); BufferedOutputStream bos =
 new BufferedOutputStream(os); CachedOutputStream.copyStream(in, bos,
 1024);

   csnew.close();
   in.close();
   bos.close();
   os.flush();

 //message.setContent(OutputStream.class, os);
   } catch (IOException e) {
   e.printStackTrace();
   }
   }

   }

 private class CachedStream extends CachedOutputStream {

 public CachedStream() {
 super();
 }

 protected void doFlush() throws IOException {
 currentStream.flush();
 }

 protected void doClose() throws IOException {
 }

 protected void onWrite() throws IOException {
 }

 }
 }

 Yuval

 dkulp wrote:
  This is definitely a bug for whomever is consuming that message.
  According to the XML rules, both messages are equivilent.
 
  Couple options:
 
  1) Best performing option:  write an interceptor that would be
  immediately AFTER the StaxOutInterceptor that would take the
  XMLStreamWriter and replace it with a new XMLStreamWriter that
  wrappers the original, but overwrides the start element and
  namespace map stuff so that it generates empty prefixes at all
  times.  That StreamWriter might be a bit tricky to write if you
  aren't familliar with StAX, but it would definitely be the best
  performing as you wouln't break the streaming, you wouldn't need to
  scan the byte[], etc  FYI: your interceptor will also need to
  set:
  msg.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIM
 IZATION, Boolean.TRUE);
  to make sure it actually uses the new StreamWriter in all cases.
 
 
  2) Next option: your CachedOutputStream stuff.   This actually
  will work, but you need to modify things a bit.  First off, it needs
  to be split into two interceptors: (usually, it's one
  interceptor.java that then has an inner class for the other.  See
  the AttachmentOutInterceptor for example)
 a) First/Outer one will replace the 

Re: REST-JS

2008-03-21 Thread Sergey Beryozkin
Hi Arul, Benson

yes, that would be a rather simple thing to do, and in fact you'd likely get 
this JS code (or indeed code in your language of choice) generated for live 
services, as we've introduced SystemQueryHandlers (not sure it's a good name 
though) which are supposed to handle different types of query extensions and 
possibly let the invocation to proceed to the actual object afterwards. For 
example, at the moment, one can debug a live service and check on what format 
it can produce, for example, if it's an Atom-enbaled service then you can try 
?_contentType=json. In this case the only thing the handler does is to update 
the Accept headers on the message.

Likewise, one should be able to do ?_js or ?_lang=js.

That said, supporting extensions like _js has not been prioritized. That would 
be a cool thing to do so if someone in the community is interested then the 
input would be welcomed.

Cheers, Sergey


 There is no existing code to do this, if I follow your definition of a
 'resource object'. It would be only a few days of work to add to the
 existing Javascript generator to add this, I bet. If you post an example of
 what you'd like to see generated that might clarify. I for one wouldn't be
 in a position to tackle the job if I've understood it correctly.
 
 

 Here is my scenario. I have a JAX-RS CXF service. I have a web
 application which consumes this service. Is it possible to generate the
 REST resources as JavaScript so that the web app can use it directly
 when doing a POST (ex: construct the resource object)?






IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Error in AbstractHTTPDestination.setHeaders, AbstractHTTPDestination.setHeaders

2008-03-21 Thread Glen Mazza
Am Freitag, den 21.03.2008, 01:27 -0400 schrieb Wolf, Chris (IT):
 If I run my service inside a Tomcat-5.5 runtime configured in
 Eclipse-3.2, all works fine. 
 I run the very same code, deployed on Tomcat-5.5 on Linux, I get this
 error.  
 If anyone can suggest something short of debuggin the CXF source, that
 would be 
 great.  I am using 2.0.4. 
 

If nobody else can answer your question, time to debug the CXF source:

http://www.jroller.com/gmazza/date/20071212

Step #5 would probably be most important for you.

Glen




Setting direct Endpoint URL

2008-03-21 Thread Red Eagle

Hi @ all

I want to communicate with an web service which doesn't provide an wsdl 
file. For generating the java classes I took an wsdl file from my file 
system.

So far so good.

I successfully implemented an client which talks to the server but the 
client takes the wsdl file. So I tried to set the Endpoint URL directly 
with the method addPort but always an exception occurred that the wsdl 
file wasn't found.


I looked into the generated service class and saw that he needs an wsdl 
file, so my question is if it is possible to switch this behaviour off.


regars



Re: REST-JS

2008-03-21 Thread Benson Margulies
Sergey,

I implemented ?js, but it generates Soap clients, not REST clients. have a
look at rt/javascript.

--benson


On Fri, Mar 21, 2008 at 6:44 AM, Sergey Beryozkin [EMAIL PROTECTED]
wrote:

 Hi Arul, Benson

 yes, that would be a rather simple thing to do, and in fact you'd likely
 get this JS code (or indeed code in your language of choice) generated for
 live services, as we've introduced SystemQueryHandlers (not sure it's a good
 name though) which are supposed to handle different types of query
 extensions and possibly let the invocation to proceed to the actual object
 afterwards. For example, at the moment, one can debug a live service and
 check on what format it can produce, for example, if it's an Atom-enbaled
 service then you can try ?_contentType=json. In this case the only thing the
 handler does is to update the Accept headers on the message.

 Likewise, one should be able to do ?_js or ?_lang=js.

 That said, supporting extensions like _js has not been prioritized. That
 would be a cool thing to do so if someone in the community is interested
 then the input would be welcomed.

 Cheers, Sergey


  There is no existing code to do this, if I follow your definition of a
  'resource object'. It would be only a few days of work to add to the
  existing Javascript generator to add this, I bet. If you post an example
 of
  what you'd like to see generated that might clarify. I for one wouldn't
 be
  in a position to tackle the job if I've understood it correctly.
 
 
 
  Here is my scenario. I have a JAX-RS CXF service. I have a web
  application which consumes this service. Is it possible to generate the
  REST resources as JavaScript so that the web app can use it directly
  when doing a POST (ex: construct the resource object)?
 
 
 
 

 
 IONA Technologies PLC (registered in Ireland)
 Registered Number: 171387
 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



Re: Setting direct Endpoint URL

2008-03-21 Thread Daniel Kulp
On Friday 21 March 2008, Red Eagle wrote:
 I want to communicate with an web service which doesn't provide an
 wsdl file. For generating the java classes I took an wsdl file from my
 file system.
 So far so good.

 I successfully implemented an client which talks to the server but the
 client takes the wsdl file. So I tried to set the Endpoint URL
 directly with the method addPort but always an exception occurred that
 the wsdl file wasn't found.

 I looked into the generated service class and saw that he needs an
 wsdl file, so my question is if it is possible to switch this
 behaviour off.

Yep.  You can pass in null for the wsdl url and just rely on the 
annotations for formatting the message.   That's perfectly fine.  The 
issue is how to set the URL that the endpoint then hits.The spec 
does allow for this via the BindingProvider:

MyThing port = service.getPort();
((BindingProvider)port).getRequestContext().put(
   BindingProvider.ENDPOINT_ADDRESS_PROPERTY,  address);



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


Re: Generated Faults and Inheritance

2008-03-21 Thread mikem2005

I'm trying to do the same thing...does anyone know if hierarchical exceptions
are possible with CXF?

Thanks!
Mike




Joel Turkel wrote:
 
 Hi,
 
 Is there anyway to get CXF to generate an inheritance hierarchy of users
 defined exceptions? For example, I'd like to generate something like the
 following from a WSDL:
 
 public interface Greeter {
 
 public void pingMe() throws PingMeSubclassFault, PingMeFault;
 
 }
 
 where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
 doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault are
 not related via inheritance. The actually WSDL I'm working with has a rich
 hierarchy of exception so the lack of exception inheritance makes the
 generated code hard to work with.
 
 Thanks,
 Joel
 
 ?xml version=1.0 encoding=UTF-8?
 wsdl:definitions name=HelloWorld
   targetNamespace=http://apache.org/hello_world_soap_http;
   xmlns=http://schemas.xmlsoap.org/wsdl/;
   xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
   xmlns:tns=http://apache.org/hello_world_soap_http;
   xmlns:x1=http://apache.org/hello_world_soap_http/types;
   xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;
   xmlns:xsd=http://www.w3.org/2001/XMLSchema;
   wsdl:types
   schema
   
 targetNamespace=http://apache.org/hello_world_soap_http/types;
   xmlns=http://www.w3.org/2001/XMLSchema;
   
 xmlns:tns=http://apache.org/hello_world_soap_http/types;
   elementFormDefault=qualified
   element name=pingMe
   complexType /
   /element
   element name=pingMeResponse
   complexType /
   /element
   element name=faultDetail type=tns:faultDetail /
   complexType name=faultDetail
   sequence
   element name=minor type=short /
   element name=major type=short /
   /sequence
   /complexType
   element name=subclassFaultDetail
   complexType
   complexContent
   extension 
 base=tns:faultDetail
   sequence /
   /extension
   /complexContent
   /complexType
   /element
   /schema
   /wsdl:types
   wsdl:message name=pingMeRequest
   wsdl:part name=in element=x1:pingMe /
   /wsdl:message
   wsdl:message name=pingMeResponse
   wsdl:part name=out element=x1:pingMeResponse /
   /wsdl:message
   wsdl:message name=pingMeFault
   wsdl:part name=faultDetail element=x1:faultDetail /
   /wsdl:message
   wsdl:message name=pingMeSubclassFault
   wsdl:part name=faultDetail element=x1:subclassFaultDetail 
 /
   /wsdl:message
   wsdl:portType name=Greeter
   wsdl:operation name=pingMe
   wsdl:input name=pingMeRequest
   message=tns:pingMeRequest /
   wsdl:output name=pingMeResponse
   message=tns:pingMeResponse /
   wsdl:fault name=pingMeFault 
 message=tns:pingMeFault /
   wsdl:fault name=pingMeSubclassFault
   message=tns:pingMeSubclassFault /
   /wsdl:operation
   /wsdl:portType
   wsdl:binding name=Greeter_SOAPBinding type=tns:Greeter
   soap:binding style=document
   transport=http://schemas.xmlsoap.org/soap/http; /
   wsdl:operation name=pingMe
   soap:operation style=document /
   wsdl:input
   soap:body use=literal /
   /wsdl:input
   wsdl:output
   soap:body use=literal /
   /wsdl:output
   wsdl:fault name=pingMeFault
   soap:fault name=pingMeFault use=literal /
   /wsdl:fault
   wsdl:fault name=pingMeSubclassFault
   soap:fault name=pingMeSubclassFault 
 use=literal /
   /wsdl:fault
   /wsdl:operation
   /wsdl:binding
   wsdl:service name=SOAPService
   wsdl:port binding=tns:Greeter_SOAPBinding name=SoapPort
   soap:address
   
 location=http://localhost:9000/SoapContext/SoapPort; /
   /wsdl:port
   /wsdl:service
 /wsdl:definitions
 

-- 

Re: Generated Faults and Inheritance

2008-03-21 Thread Benson Margulies
Aegis allows you to declare a base class in the throw clause and deliver
specific subclasses based on the actual class thrown. All the classes in
question end up in the wsdl.



On Fri, Mar 21, 2008 at 9:41 AM, mikem2005 [EMAIL PROTECTED] wrote:


 I'm trying to do the same thing...does anyone know if hierarchical
 exceptions
 are possible with CXF?

 Thanks!
 Mike




 Joel Turkel wrote:
 
  Hi,
 
  Is there anyway to get CXF to generate an inheritance hierarchy of users
  defined exceptions? For example, I'd like to generate something like the
  following from a WSDL:
 
  public interface Greeter {
 
  public void pingMe() throws PingMeSubclassFault, PingMeFault;
 
  }
 
  where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
  doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
 are
  not related via inheritance. The actually WSDL I'm working with has a
 rich
  hierarchy of exception so the lack of exception inheritance makes the
  generated code hard to work with.
 
  Thanks,
  Joel
 
  ?xml version=1.0 encoding=UTF-8?
  wsdl:definitions name=HelloWorld
targetNamespace=http://apache.org/hello_world_soap_http;
xmlns=http://schemas.xmlsoap.org/wsdl/;
xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
xmlns:tns=http://apache.org/hello_world_soap_http;
xmlns:x1=http://apache.org/hello_world_soap_http/types;
xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
wsdl:types
schema
targetNamespace=
 http://apache.org/hello_world_soap_http/types;
xmlns=http://www.w3.org/2001/XMLSchema;
xmlns:tns=
 http://apache.org/hello_world_soap_http/types;
elementFormDefault=qualified
element name=pingMe
complexType /
/element
element name=pingMeResponse
complexType /
/element
element name=faultDetail type=tns:faultDetail
 /
complexType name=faultDetail
sequence
element name=minor type=short
 /
element name=major type=short
 /
/sequence
/complexType
element name=subclassFaultDetail
complexType
complexContent
extension
 base=tns:faultDetail
sequence /
/extension
/complexContent
/complexType
/element
/schema
/wsdl:types
wsdl:message name=pingMeRequest
wsdl:part name=in element=x1:pingMe /
/wsdl:message
wsdl:message name=pingMeResponse
wsdl:part name=out element=x1:pingMeResponse /
/wsdl:message
wsdl:message name=pingMeFault
wsdl:part name=faultDetail element=x1:faultDetail /
/wsdl:message
wsdl:message name=pingMeSubclassFault
wsdl:part name=faultDetail
 element=x1:subclassFaultDetail /
/wsdl:message
wsdl:portType name=Greeter
wsdl:operation name=pingMe
wsdl:input name=pingMeRequest
message=tns:pingMeRequest /
wsdl:output name=pingMeResponse
message=tns:pingMeResponse /
wsdl:fault name=pingMeFault
 message=tns:pingMeFault /
wsdl:fault name=pingMeSubclassFault
message=tns:pingMeSubclassFault /
/wsdl:operation
/wsdl:portType
wsdl:binding name=Greeter_SOAPBinding type=tns:Greeter
soap:binding style=document
transport=http://schemas.xmlsoap.org/soap/http;
 /
wsdl:operation name=pingMe
soap:operation style=document /
wsdl:input
soap:body use=literal /
/wsdl:input
wsdl:output
soap:body use=literal /
/wsdl:output
wsdl:fault name=pingMeFault
soap:fault name=pingMeFault
 use=literal /
/wsdl:fault
wsdl:fault name=pingMeSubclassFault
soap:fault name=pingMeSubclassFault
 use=literal /
/wsdl:fault
   

Re: REST-JS

2008-03-21 Thread Arul Dhesiaseelan
I was exactly looking for something like this on the rest endpoint. I am 
using JAXRSServerFactoryBean for deploying the rest endpoint.


Thanks!
Arul

Benson Margulies wrote:

Sergey,

I implemented ?js, but it generates Soap clients, not REST clients. have a
look at rt/javascript.

--benson


On Fri, Mar 21, 2008 at 6:44 AM, Sergey Beryozkin [EMAIL PROTECTED]
wrote:

  

Hi Arul, Benson

yes, that would be a rather simple thing to do, and in fact you'd likely
get this JS code (or indeed code in your language of choice) generated for
live services, as we've introduced SystemQueryHandlers (not sure it's a good
name though) which are supposed to handle different types of query
extensions and possibly let the invocation to proceed to the actual object
afterwards. For example, at the moment, one can debug a live service and
check on what format it can produce, for example, if it's an Atom-enbaled
service then you can try ?_contentType=json. In this case the only thing the
handler does is to update the Accept headers on the message.

Likewise, one should be able to do ?_js or ?_lang=js.

That said, supporting extensions like _js has not been prioritized. That
would be a cool thing to do so if someone in the community is interested
then the input would be welcomed.

Cheers, Sergey




There is no existing code to do this, if I follow your definition of a
'resource object'. It would be only a few days of work to add to the
existing Javascript generator to add this, I bet. If you post an example
  

of


what you'd like to see generated that might clarify. I for one wouldn't
  

be


in a position to tackle the job if I've understood it correctly.


  

Here is my scenario. I have a JAX-RS CXF service. I have a web
application which consumes this service. Is it possible to generate the
REST resources as JavaScript so that the web app can use it directly
when doing a POST (ex: construct the resource object)?






IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland





__
Scanned by MessageLabs
__
  



--
Arul Dhesiaseelan, Flux Development

+1 (406) 656-7398
www.fluxcorp.com

Flux - Java Job Scheduler. File Transfer. Workflow. BPM. 





Re: Setting direct Endpoint URL

2008-03-21 Thread Red Eagle

Thanks for your fast reply,

I tried your solution but i'm always getting an null pointer exception 
we because service.getPort returns it. I used wsdl2java to generate all 
the jaxb classes.

Can you give me a hint how i can solve this null pointer problem

regards


Daniel Kulp schrieb:

On Friday 21 March 2008, Red Eagle wrote:
  

I want to communicate with an web service which doesn't provide an
wsdl file. For generating the java classes I took an wsdl file from my
file system.
So far so good.

I successfully implemented an client which talks to the server but the
client takes the wsdl file. So I tried to set the Endpoint URL
directly with the method addPort but always an exception occurred that
the wsdl file wasn't found.

I looked into the generated service class and saw that he needs an
wsdl file, so my question is if it is possible to switch this
behaviour off.



Yep.  You can pass in null for the wsdl url and just rely on the 
annotations for formatting the message.   That's perfectly fine.  The 
issue is how to set the URL that the endpoint then hits.The spec 
does allow for this via the BindingProvider:


MyThing port = service.getPort();
((BindingProvider)port).getRequestContext().put(
   BindingProvider.ENDPOINT_ADDRESS_PROPERTY,  address);



  




RE: Error in AbstractHTTPDestination.setHeaders,AbstractHTTPDestination.setHeaders

2008-03-21 Thread Wolf, Chris (IT)
Glen,

Thanks again for your help.  I downloaded the source and looked at it 
before going through the laborious task of setting up for remote
debugging.

I can see the the issue is the code in AbstractHTTPDestination always 
assumes the value of the Authorization header will always be a base64
encoded username:password value -- in my case, we use Siteminder
authentication,
so sometimes the value of the Authorization header is just the base64
encoded
username -- without a colon and password, i.e. no :passw, which
exactly
explains this array index out of bounds exception. 

The workaround is, I'm going to tell my users to log out of Siteminder
and re-authenticate, such that the Authorization header always has
both
pieces in the value. 

I would like to present a patch for the case where the Authorization 
header value does not contain a colon character, even for Basic
type of authentication, but I'm not sure special accomodation would be
made for Siteminder, unelss the RFC for Basic authentication says the
Authorization header may contain just an encoded username in certain 
circumstances.

 
-Chris

-Original Message-
From: Glen Mazza [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 21, 2008 7:12 AM
To: cxf-user@incubator.apache.org
Subject: Re: Error in
AbstractHTTPDestination.setHeaders,AbstractHTTPDestination.setHeaders

Am Freitag, den 21.03.2008, 01:27 -0400 schrieb Wolf, Chris (IT):
 If I run my service inside a Tomcat-5.5 runtime configured in 
 Eclipse-3.2, all works fine.
 I run the very same code, deployed on Tomcat-5.5 on Linux, I get this 
 error.
 If anyone can suggest something short of debuggin the CXF source, that

 would be great.  I am using 2.0.4.
 

If nobody else can answer your question, time to debug the CXF source:

http://www.jroller.com/gmazza/date/20071212

Step #5 would probably be most important for you.

Glen


NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.


Re: Setting direct Endpoint URL

2008-03-21 Thread Daniel Kulp

Ooopss.  Missed a line in there:

QName portName = new  QName(http://the.name.space;, 
MyPort);
QName servName = new QName(http://the.name.space;, 
MyService);

Service service = Service.create(servName);
service.addPort(portName,
  SOAPBinding.SOAP11HTTP_BINDING, 
  address);
MyPortType port = service.getPort(portName, MyPortType.class);


Dan


On Friday 21 March 2008, Daniel Kulp wrote:
 On Friday 21 March 2008, Red Eagle wrote:
  Thanks for your fast reply,
 
  I tried your solution but i'm always getting an null pointer
  exception we because service.getPort returns it. I used wsdl2java to
  generate all the jaxb classes.
  Can you give me a hint how i can solve this null pointer problem

 The easiest way may be to just throw out the generated Service class
 (just use the interface and types) via:




 QName portName = new  QName(http://the.name.space;,
 MyPort);
 QName servName = new QName(http://the.name.space;,
 MyService);

 Service service = Service.create(servName);
 MyPortType port = service.getPort(portName, MyPortType.class);
 ((BindingProvider)port).get.

 Dan

  regards
 
  Daniel Kulp schrieb:
   On Friday 21 March 2008, Red Eagle wrote:
   I want to communicate with an web service which doesn't provide
   an wsdl file. For generating the java classes I took an wsdl file
   from my file system.
   So far so good.
  
   I successfully implemented an client which talks to the server
   but the client takes the wsdl file. So I tried to set the
   Endpoint URL directly with the method addPort but always an
   exception occurred that the wsdl file wasn't found.
  
   I looked into the generated service class and saw that he needs
   an wsdl file, so my question is if it is possible to switch this
   behaviour off.
  
   Yep.  You can pass in null for the wsdl url and just rely on the
   annotations for formatting the message.   That's perfectly fine.
   The issue is how to set the URL that the endpoint then hits.   
   The spec does allow for this via the BindingProvider:
  
   MyThing port = service.getPort();
   ((BindingProvider)port).getRequestContext().put(
  BindingProvider.ENDPOINT_ADDRESS_PROPERTY,  address);



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


Re: Generated Faults and Inheritance

2008-03-21 Thread Benson Margulies
1) Build code-first with Aegis.
2) Run java2ws from 2.1 with the Aegis databinding.
3) Use that WDSL as your starting point.

Warning: while I've worked on the code that supports all of this, I've never
looked closely at what come out of it.

On Fri, Mar 21, 2008 at 11:24 AM, Joel Turkel [EMAIL PROTECTED]
wrote:


 Is there anyway to do this using WSDL first development?


 Benson Margulies-4 wrote:
 
  Aegis allows you to declare a base class in the throw clause and deliver
  specific subclasses based on the actual class thrown. All the classes in
  question end up in the wsdl.
 
 
 
  On Fri, Mar 21, 2008 at 9:41 AM, mikem2005 [EMAIL PROTECTED] wrote:
 
 
  I'm trying to do the same thing...does anyone know if hierarchical
  exceptions
  are possible with CXF?
 
  Thanks!
  Mike
 
 
 
 
  Joel Turkel wrote:
  
   Hi,
  
   Is there anyway to get CXF to generate an inheritance hierarchy of
  users
   defined exceptions? For example, I'd like to generate something like
  the
   following from a WSDL:
  
   public interface Greeter {
  
   public void pingMe() throws PingMeSubclassFault, PingMeFault;
  
   }
  
   where PingMeSubclassFault is a subclass of PingMeFault. The WSDL
 below
   doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
  are
   not related via inheritance. The actually WSDL I'm working with has a
  rich
   hierarchy of exception so the lack of exception inheritance makes the
   generated code hard to work with.
  
   Thanks,
   Joel
  
   ?xml version=1.0 encoding=UTF-8?
   wsdl:definitions name=HelloWorld
 targetNamespace=http://apache.org/hello_world_soap_http;
 xmlns=http://schemas.xmlsoap.org/wsdl/;
 xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
 xmlns:tns=http://apache.org/hello_world_soap_http;
 xmlns:x1=http://apache.org/hello_world_soap_http/types;
 xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
 wsdl:types
 schema
 targetNamespace=
  http://apache.org/hello_world_soap_http/types;
 xmlns=http://www.w3.org/2001/XMLSchema;
 xmlns:tns=
  http://apache.org/hello_world_soap_http/types;
 elementFormDefault=qualified
 element name=pingMe
 complexType /
 /element
 element name=pingMeResponse
 complexType /
 /element
 element name=faultDetail
  type=tns:faultDetail
  /
 complexType name=faultDetail
 sequence
 element name=minor
  type=short
  /
 element name=major
  type=short
  /
 /sequence
 /complexType
 element name=subclassFaultDetail
 complexType
 complexContent
 extension
  base=tns:faultDetail
 sequence /
 /extension
 /complexContent
 /complexType
 /element
 /schema
 /wsdl:types
 wsdl:message name=pingMeRequest
 wsdl:part name=in element=x1:pingMe /
 /wsdl:message
 wsdl:message name=pingMeResponse
 wsdl:part name=out element=x1:pingMeResponse /
 /wsdl:message
 wsdl:message name=pingMeFault
 wsdl:part name=faultDetail element=x1:faultDetail
 /
 /wsdl:message
 wsdl:message name=pingMeSubclassFault
 wsdl:part name=faultDetail
  element=x1:subclassFaultDetail /
 /wsdl:message
 wsdl:portType name=Greeter
 wsdl:operation name=pingMe
 wsdl:input name=pingMeRequest
 message=tns:pingMeRequest /
 wsdl:output name=pingMeResponse
 message=tns:pingMeResponse /
 wsdl:fault name=pingMeFault
  message=tns:pingMeFault /
 wsdl:fault name=pingMeSubclassFault
 message=tns:pingMeSubclassFault /
 /wsdl:operation
 /wsdl:portType
 wsdl:binding name=Greeter_SOAPBinding type=tns:Greeter
 soap:binding style=document
 transport=http://schemas.xmlsoap.org/soap/http
 
  /
 wsdl:operation name=pingMe
 soap:operation style=document /
 wsdl:input
   

Re: Generated Faults and Inheritance

2008-03-21 Thread Daniel Kulp

I don't think so using normal looking java exception.  You could do it 
if you model your exceptions exactly like the exceptions would look like 
if you generated code from wsdl.   Basically, put the data in JAXB Beans 
that implement the heiarchy you want to see in the wsdl, then add Bean 
getFaultInfo() methods to the exceptions to return the JAXB Beans.

Even then, I'm not sure if it will actually work.

Dan


On Tuesday 18 March 2008, Joel_Turkel wrote:
 Hi,

 Is there anyway to get CXF to generate an inheritance hierarchy of
 users defined exceptions? For example, I'd like to generate something
 like the following from a WSDL:

 public interface Greeter {

 public void pingMe() throws PingMeSubclassFault, PingMeFault;

 }

 where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
 doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
 are not related via inheritance. The actually WSDL I'm working with
 has a rich hierarchy of exception so the lack of exception inheritance
 makes the generated code hard to work with.

 Thanks,
 Joel

 ?xml version=1.0 encoding=UTF-8?
 wsdl:definitions name=HelloWorld
   targetNamespace=http://apache.org/hello_world_soap_http;
   xmlns=http://schemas.xmlsoap.org/wsdl/;
   xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/;
   xmlns:tns=http://apache.org/hello_world_soap_http;
   xmlns:x1=http://apache.org/hello_world_soap_http/types;
   xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;
   xmlns:xsd=http://www.w3.org/2001/XMLSchema;
   wsdl:types
   schema
   
 targetNamespace=http://apache.org/hello_world_soap_http/types;
   xmlns=http://www.w3.org/2001/XMLSchema;
   
 xmlns:tns=http://apache.org/hello_world_soap_http/types;
   elementFormDefault=qualified
   element name=pingMe
   complexType /
   /element
   element name=pingMeResponse
   complexType /
   /element
   element name=faultDetail type=tns:faultDetail /
   complexType name=faultDetail
   sequence
   element name=minor type=short /
   element name=major type=short /
   /sequence
   /complexType
   element name=subclassFaultDetail
   complexType
   complexContent
   extension 
 base=tns:faultDetail
   sequence /
   /extension
   /complexContent
   /complexType
   /element
   /schema
   /wsdl:types
   wsdl:message name=pingMeRequest
   wsdl:part name=in element=x1:pingMe /
   /wsdl:message
   wsdl:message name=pingMeResponse
   wsdl:part name=out element=x1:pingMeResponse /
   /wsdl:message
   wsdl:message name=pingMeFault
   wsdl:part name=faultDetail element=x1:faultDetail /
   /wsdl:message
   wsdl:message name=pingMeSubclassFault
   wsdl:part name=faultDetail element=x1:subclassFaultDetail 
 /
   /wsdl:message
   wsdl:portType name=Greeter
   wsdl:operation name=pingMe
   wsdl:input name=pingMeRequest
   message=tns:pingMeRequest /
   wsdl:output name=pingMeResponse
   message=tns:pingMeResponse /
   wsdl:fault name=pingMeFault 
 message=tns:pingMeFault /
   wsdl:fault name=pingMeSubclassFault
   message=tns:pingMeSubclassFault /
   /wsdl:operation
   /wsdl:portType
   wsdl:binding name=Greeter_SOAPBinding type=tns:Greeter
   soap:binding style=document
   transport=http://schemas.xmlsoap.org/soap/http; /
   wsdl:operation name=pingMe
   soap:operation style=document /
   wsdl:input
   soap:body use=literal /
   /wsdl:input
   wsdl:output
   soap:body use=literal /
   /wsdl:output
   wsdl:fault name=pingMeFault
   soap:fault name=pingMeFault use=literal /
   /wsdl:fault
   wsdl:fault name=pingMeSubclassFault
   soap:fault name=pingMeSubclassFault 
 use=literal /
   /wsdl:fault
   /wsdl:operation
   

Re: REST-JS

2008-03-21 Thread Sergey Beryozkin

Hi Benson

For current CXF JAX-RS impl, the idea is to treat queries starting from '_' as system ones, intended for the JAX-RS runtime, such 
that such queries can be distinguished from application-specific ones. We've added SystemQueryHandlers which are invoked before the 
actual target object, so one of such handlers can be created to handle '_js' extension to avoid a clash with ?js support in 
runtime/js...


Cheers, Sergey 



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: REST-JS

2008-03-21 Thread Benson Margulies
Oh, I see, I was completely confused. I didn't appreciate that you were
talking about ? handling in the JAX-RS code. Still, you might find some code
you like in rt/javascript if/when you look at this ?js for REST.


On Fri, Mar 21, 2008 at 1:27 PM, Sergey Beryozkin [EMAIL PROTECTED]
wrote:

 Hi Benson

 For current CXF JAX-RS impl, the idea is to treat queries starting from
 '_' as system ones, intended for the JAX-RS runtime, such
 that such queries can be distinguished from application-specific ones.
 We've added SystemQueryHandlers which are invoked before the
 actual target object, so one of such handlers can be created to handle
 '_js' extension to avoid a clash with ?js support in
 runtime/js...

 Cheers, Sergey

 
 IONA Technologies PLC (registered in Ireland)
 Registered Number: 171387
 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



RE: Error in AbstractHTTPDestination.setHeaders,AbstractHTTPDestination.setHeaders

2008-03-21 Thread Glen Mazza
I've been looking at our Basic Authentication recently--the error
messages have been cryptic in many cases, not providing acceptable
feedback.  

In your case below, we should have a precise error message about an
invalid format in the Authorization header field--not just an NPE of
course.  If you could submit a JIRA for this it would be appreciated,
else I'll try to remember.

I don't think we should make an exception for Siteminder though, because
that might open up a security hole.  Also, Section two of RFC 2617[1]
states:  To receive authorization, the client sends the userid and
password, separated by a single colon (:) character, within a base64
[7] encoded string in the credentials.  Apparently both username and
password are always needed.  I don't know Siteminder but I would think
they would have an option to always supply a password in order to be RFC
2617 compliant.  If not, please let them know about it.

Thanks,
Glen


[1] http://www.faqs.org/rfcs/rfc2617.html

Am Freitag, den 21.03.2008, 11:30 -0400 schrieb Wolf, Chris (IT):
 Glen,
 
 Thanks again for your help.  I downloaded the source and looked at it 
 before going through the laborious task of setting up for remote
 debugging.
 
 I can see the the issue is the code in AbstractHTTPDestination always 
 assumes the value of the Authorization header will always be a base64
 encoded username:password value -- in my case, we use Siteminder
 authentication,
 so sometimes the value of the Authorization header is just the base64
 encoded
 username -- without a colon and password, i.e. no :passw, which
 exactly
 explains this array index out of bounds exception. 
 
 The workaround is, I'm going to tell my users to log out of Siteminder
 and re-authenticate, such that the Authorization header always has
 both
 pieces in the value. 
 
 I would like to present a patch for the case where the Authorization 
 header value does not contain a colon character, even for Basic
 type of authentication, but I'm not sure special accomodation would be
 made for Siteminder, unelss the RFC for Basic authentication says the
 Authorization header may contain just an encoded username in certain 
 circumstances.
 
  
 -Chris
 
 -Original Message-
 From: Glen Mazza [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 21, 2008 7:12 AM
 To: cxf-user@incubator.apache.org
 Subject: Re: Error in
 AbstractHTTPDestination.setHeaders,AbstractHTTPDestination.setHeaders
 
 Am Freitag, den 21.03.2008, 01:27 -0400 schrieb Wolf, Chris (IT):
  If I run my service inside a Tomcat-5.5 runtime configured in 
  Eclipse-3.2, all works fine.
  I run the very same code, deployed on Tomcat-5.5 on Linux, I get this 
  error.
  If anyone can suggest something short of debuggin the CXF source, that
 
  would be great.  I am using 2.0.4.
  
 
 If nobody else can answer your question, time to debug the CXF source:
 
 http://www.jroller.com/gmazza/date/20071212
 
 Step #5 would probably be most important for you.
 
 Glen
 
 
 NOTICE: If received in error, please destroy and notify sender. Sender does 
 not intend to waive confidentiality or privilege. Use of this email is 
 prohibited when received in error.