You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by csaban <cs...@yahoo.ca> on 2010/03/30 21:49:56 UTC

Re: How to consume SharePoint Service Response (Java/.NET interop)?

Probably this is late now, but I was facing the same issue. (Sharepoint,
NTLMv2, List[null])

Using JAXB GetList always returned null, but switching to XMLBEANS I do get
the xml content of the getList response.

Hope this helps someone.

--
Csaba


mmule wrote:
> 
> Hello,
> 
> Do you have a solution for this yet? I am facing a similar issue. The CXF
> is returning null.
> 
> Please share if you have the solution.
> 
> Thanks
> M
> 

-- 
View this message in context: http://old.nabble.com/How-to-consume-SharePoint-Service-Response-%28Java-.NET-interop%29--tp25263932p28087549.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to consume SharePoint Service Response (Java/.NET interop)?

Posted by csaban <cs...@yahoo.ca>.
Yes, you need to add additional code to parse the XML yourself.
This interceptor just allows you to capture the XML, it won't fix/change the
returned List value.

But now that you have the XML you can extract what you need to process it.


Mike SP wrote:
> 
> I tried this interceptor below.  I added some printlns and saw that the
> originalXML string was being set correctly.  However, that string is not
> used anywhere so I'm not sure if this is missing some code or not.  The
> end result is that even though I can see that the correct data is
> available in the handleMessage, using that code below, it doesn't work
> still.  I still get the null List object back.  Is there additional code
> beyond this that is needed to make it work?  
> 
> 
> csaban wrote:
>> 
>> 
>> <code>
>> 	static class MyInterceptor extends AbstractPhaseInterceptor<Message> {
>> 		
>> 		public MyInterceptor() {
>> 			super(Phase.POST_STREAM);
>> 			
>> 			getBefore().add(StaxInInterceptor.class.getName());
>> 		}
>> 		
>> 		public void handleMessage(Message msg) throws
>> org.apache.cxf.interceptor.Fault {
>> 			InputStream is = msg.getContent(InputStream.class);
>>                         assert is != null;
>> 						
>> 			try {
>> 				byte[] byteContent = IOUtils.readBytesFromStream(is);
>> 				msg.setContent(InputStream.class, new
>> ByteArrayInputStream(byteContent));
>> 				String encoding = (String) msg.get(Message.ENCODING);
>> 				String originalXML = new String(byteContent,encoding);
>> 			} catch(Exception e) {
>> 				//FIXME: handle exception
>> 				e.printStackTrace();
>> 			}
>> 			
>> 		}
>> 	}
>> </code>
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-consume-SharePoint-Service-Response-%28Java-.NET-interop%29--tp25263932p28296456.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to consume SharePoint Service Response (Java/.NET interop)?

Posted by Mike SP <m....@monsanto.com>.
I tried this interceptor below.  I added some printlns and saw that the
originalXML string was being set correctly.  However, that string is not
used anywhere so I'm not sure if this is missing some code or not.  The end
result is that even though I can see that the correct data is available in
the handleMessage, using that code below, it doesn't work still.  I still
get the null List object back.  Is there additional code beyond this that is
needed to make it work?  


csaban wrote:
> 
> Oh yes, forgot to mention, another way would be with JAXB is to add an
> interceptor and process the stream before the StaxInInterceptor does.
> 
> eg:
> 
> <code>
> 	static class MyInterceptor extends AbstractPhaseInterceptor<Message> {
> 		
> 		public MyInterceptor() {
> 			super(Phase.POST_STREAM);
> 			
> 			getBefore().add(StaxInInterceptor.class.getName());
> 		}
> 		
> 		public void handleMessage(Message msg) throws
> org.apache.cxf.interceptor.Fault {
> 			InputStream is = msg.getContent(InputStream.class);
>                         assert is != null;
> 						
> 			try {
> 				byte[] byteContent = IOUtils.readBytesFromStream(is);
> 				msg.setContent(InputStream.class, new
> ByteArrayInputStream(byteContent));
> 				String encoding = (String) msg.get(Message.ENCODING);
> 				String originalXML = new String(byteContent,encoding);
> 			} catch(Exception e) {
> 				//FIXME: handle exception
> 				e.printStackTrace();
> 			}
> 			
> 		}
> 	}
> </code>
> 
> 
> csaban wrote:
>> 
>> Probably this is late now, but I was facing the same issue. (Sharepoint,
>> NTLMv2, List[null])
>> 
>> Using JAXB GetList always returned null, but switching to XMLBEANS I do
>> get the xml content of the getList response.
>> 
>> Hope this helps someone.
>> 
>> --
>> Csaba
>> 
>> 
>> mmule wrote:
>>> 
>>> Hello,
>>> 
>>> Do you have a solution for this yet? I am facing a similar issue. The
>>> CXF is returning null.
>>> 
>>> Please share if you have the solution.
>>> 
>>> Thanks
>>> M
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-consume-SharePoint-Service-Response-%28Java-.NET-interop%29--tp25263932p28288043.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to consume SharePoint Service Response (Java/.NET interop)?

Posted by csaban <cs...@yahoo.ca>.
Oh yes, forgot to mention, another way would be with JAXB is to add an
interceptor and process the stream before the StaxInInterceptor does.

eg:

<code>
	static class MyInterceptor extends AbstractPhaseInterceptor<Message> {
		
		public MyInterceptor() {
			super(Phase.POST_STREAM);
			
			getBefore().add(StaxInInterceptor.class.getName());
		}
		
		public void handleMessage(Message msg) throws
org.apache.cxf.interceptor.Fault {
			InputStream is = msg.getContent(InputStream.class);
                        assert is != null;
						
			try {
				byte[] byteContent = IOUtils.readBytesFromStream(is);
				msg.setContent(InputStream.class, new
ByteArrayInputStream(byteContent));
				String encoding = (String) msg.get(Message.ENCODING);
				String originalXML = new String(byteContent,encoding);
			} catch(Exception e) {
				//FIXME: handle exception
				e.printStackTrace();
			}
			
		}
	}
</code>


csaban wrote:
> 
> Probably this is late now, but I was facing the same issue. (Sharepoint,
> NTLMv2, List[null])
> 
> Using JAXB GetList always returned null, but switching to XMLBEANS I do
> get the xml content of the getList response.
> 
> Hope this helps someone.
> 
> --
> Csaba
> 
> 
> mmule wrote:
>> 
>> Hello,
>> 
>> Do you have a solution for this yet? I am facing a similar issue. The CXF
>> is returning null.
>> 
>> Please share if you have the solution.
>> 
>> Thanks
>> M
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-consume-SharePoint-Service-Response-%28Java-.NET-interop%29--tp25263932p28087647.html
Sent from the cxf-user mailing list archive at Nabble.com.