Re: Basic authentication as a client

2008-04-21 Thread Vijay Allam
You may want to use JAX-WS code to accomplish this.

  QName SERVICE_NAME = new QName("http://yournamespace.com";,
"MyWebServiceService");  QName PORT_NAME = new QName(
"http://yournamespace.com";, "MyService");


Service service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, myConfig
.getUrl());MyWebService port = service.getPort(PORT_NAME,
MyService.class);BindingProvider provider = (BindingProvider) port;
Map requestContext = provider.getRequestContext();
requestContext.put(BindingProvider.PASSWORD_PROPERTY,
myConfig.getPassword());
requestContext.put(BindingProvider.USERNAME_PROPERTY, myConfig.getUserID());



MyConfig is an environment aware config class which dynamically loads my
configurations uid,pwd , service endpoint url etc from propertyfile.

--Vijay

On 4/21/08 4:57 PM, "Bitsch. Frederic" <[EMAIL PROTECTED]> wrote:

> 
> 
> Hi,
> 
>  I'm facing a problem with basic authentication when consuming a service
> with CXF.
> 
> Currently the cxf-configuration XML contains these lines for each
> service my client is invoking:
> 
>  
> 
> 
> 
>  xmlns="http://cxf.apache.org/configuration/security";>@@username@@ ame>
> 
>  xmlns="http://cxf.apache.org/configuration/security";>@@password@@ ord>
> 
> 
> 
>  
> 
> The tokens @@username@@ and @@password@@ are replaced by the classoader
> (loading the resource) to allow
> 
> dynamic configuration. This is required because the consumed services
> can be deployed on different servers having
> 
> different security settings (user credentials). I have not yet found a
> way to accomplish this with CXF which is not requiring
> 
> the classloader workaround.
> 
>  
> 
> This is how I instantiate the service-consumer:
> 
>  
> 
> new
> MyService(ReplacingClassloader.getInstance().getResource("wsdl/myservice
> /main.wsdl"),
> 
> new QName("urn:MyServiceWsd", "MyService"););
> 
>  
> 
> Any ideas how this can be done programmatically ?
> 
>  
> 
> Regards,
> 
> Frederic
> 
>  
> 
> _
> 
> SEEBURGER AGVorstand/Seeburger Executive Board:
> Sitz der Gesellschaft/   Bernd Seeburger, Axel Haas, Michael Kleeberg
> Registered Office:
> Edisonstrasse 1Vorsitzender des Aufsichtsrats/Chairperson of
> D-75015 Brettenthe Seeburger Supervisory Board:
> Tel.: 07252 / 96-0   Dr. Franz Scherer
> Fax:  07252 / 96-
> Internet: http://www.seeburger.de Registergericht/Commercial Register:
> e-mail: [EMAIL PROTECTED]  HRB 240708 Mannheim
> _
> 
> Dieses E-Mail ist nur fur den Empfanger bestimmt, an den es gerichtet
> ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes
> Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs-
> au?erung ist die des Autors und stellt nicht notwendigerweise die
> Ansicht oder Meinung der SEEBURGER AG dar.
> Sind Sie nicht der Empfanger, so haben Sie diese E-Mail irrtumlich
> erhalten und jegliche Verwendung, Veroffentlichung, Weiterleitung,
> Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt.
> Weder die SEEBURGER AG noch der Absender (Frederic Bitsch)
> ubernehmen die Haftung fur Viren; es obliegt Ihrer Verantwortung,
> die E-Mail und deren Anhange (0) auf Viren zu prufen.
> 
> The present email addresses only the addressee which it targets and
> may contain confidential material that may be protected by the
> professional secret. The opinions reflected herein are not necessarily
> the one of the SEEBURGER AG.
> If you are not the addressee, you have accidentally got this email and
> are not enabled to use, publish, forward, copy or print it in any way.
> Neither the SEEBURGER AG, nor the sender (Frederic Bitsch) are
> liable for viruses, being your own responsibility to check this email
> and its attachments (0) for this purpose.
> _
> 



Re: SoapWithAttachments - missing images

2008-04-09 Thread Vijay Allam

Yes the image inside the pdf is missing. I have not tried diffing. I will
try and see if I see any truncation in the two files.
I was able to open the PDF even though the image is missing.

--Vijay

On 4/9/08 1:06 PM, "Benson Margulies" <[EMAIL PROTECTED]> wrote:

> An image from *inside* the PDF is missing? That's hard to believe. Have you
> just diffed the PDF to see the nature of the problem? Is it just truncated?
> 




SoapWithAttachments - missing images

2008-04-09 Thread Vijay Allam
I was able to get the attachments to the client as per Dan's suggestion.

Howerver, I'm missing an image in the attachment. The attachment are of
type pdf. 

When I use SoapUI to test the service, I was able to get the pdf without a
problem. 

I have tried Xfire client and I see a missing image on the pdf as well.


Any pointers..ideas..

--Vijay 

On 4/4/08 12:26 PM, "Daniel Kulp" <[EMAIL PROTECTED]> wrote:

> On Friday 04 April 2008, Benson Margulies wrote:
>> SwA is different from MTOM. I don't know of CXF does SwA.
> 
> It does for the jaxws frontend as the jaxws spec requires it.  It's
> pretty much tied to how the jaxws spec requires the code to be generated
> which is why the code lives in the jaxws frontend.   Also, the
> processing is a bit more complex than mtom so we only add the swa
> interceptors if the JAX-WS interface/wsdl indicates that there will be
> swa attachments.
> 
> Dan
> 
> 
>> 
>> On Fri, Apr 4, 2008 at 11:07 AM, Vijay Allam <
>> 
>> [EMAIL PROTECTED]> wrote:
>>> In this case I do not have element that represents the attachment in
>>> WSDL. It comes as part of the Soap message as multi part attachment.
>>> So not sure how do I get the attachment. I could only find code that
>>> can easily get attachment using axis1.1 for the request.
>>> 
>>> --Vijay
>>> 
>>> On 4/3/08 7:58 PM, "Freeman Fang" <[EMAIL PROTECTED]> wrote:
>>>> Hi Vijay,
>>>> 
>>>> We have mtom demo in the kit, which shows how SOAP message
>>>> with an attachment and XML-binary Optimized Packaging(mtom)  work.
>>>> 
>>>> Regards
>>>> 
>>>> Freeman
>>>> 
>>>> Vijay Allam wrote:
>>>>> I have a third part webservice that returns an attachment. How do
>>>>> I get
>>> 
>>> the
>>> 
>>>>> attachment with CXF client. Any example code is apreciated.
>>>>> 
>>>>> --Vijay
>>>>> 
>>>>> On 4/3/08 9:57 AM, "Cencio" <[EMAIL PROTECTED]> wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> i'm still unable to retrieve the wsdl from my service... i post
>>>>>> all my
>>> 
>>> info:
>>>>>> web.xml:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> contextConfigLocation
>>>>>> WEB-INF/beans.xml
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> org.springframework.web.context.ContextLoaderListener
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> CXFServlet
>>>>>> CXF Servlet
>>>>>> 
>>>>>> 
>>>>>> org.apache.cxf.transport.servlet.CXFServlet 
>>>>>> 1
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> CXFServlet
>>>>>> /*
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> beans.xml:
>>>>>> 
>>>>>> http://www.springframework.org/schema/beans";
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>>>> xmlns:jaxws="http://cxf.apache.org/jaxws";
>>>>>> xsi:schemaLocation="
>>>>>> http://www.springframework.org/schema/beans
>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>> http://cxf.apache.org/jaxws
>>>>>> http://cxf.apache.org/schemas/jaxws.xsd";>
>>>>>> 
>>>>>> 
>>>>>> >> 
>>> resource="classpath:META-INF/cxf/cxf-extension-soap.xml"

Re: SoapWithAttachments

2008-04-04 Thread Vijay Allam
 

Thanks a lot.  This is what I'm looking for to get the attachment from the
client. ((BindingProvider)proxy).getRequestContext().get("ATTACHMENTS");

It was a third party web service. I have already have the interceptor but I
did not know how to get the attachment back to the client.

This will solve my problem.

--Thanks
Vijay 


On 4/4/08 12:15 PM, "Daniel Kulp" <[EMAIL PROTECTED]> wrote:

> 
> Ick...  If their wsdl properly declared the attachments like a good
> contract would, it would be easy as the generated code would just handle
> it.
> 
> I just spent some time trying to figure out something and I'm not
> succeeding unless you write an interceptor.  The Message object sent
> into an interceptor has the attachements collection on it.   Thus, if
> you did something like:
> 
> 
> public static class MyInterceptor
> extends AbstractPhaseInterceptor {
> 
> public MyInterceptor() {
> super(Phase.USER_LOGICAL);
> }
> 
> public void handleMessage(Message message) throws Fault {
> message.put("ATTACHMENTS", message.getAttachments());
> }
> }
> 
> That will copy the attachment list to the message properties and you can
> then retrieve it in the client code like:
> 
> ((BindingProvider)proxy).getRequestContext().get("ATTACHMENTS");
> 
> 
> Dan
> 
> 
> 
> On Friday 04 April 2008, Vijay Allam wrote:
>> In this case I do not have element that represents the attachment in
>> WSDL. It comes as part of the Soap message as multi part attachment.
>> So not sure how do I get the attachment. I could only find code that
>> can easily get attachment using axis1.1 for the request.
>> 
>> --Vijay
>> 
>> On 4/3/08 7:58 PM, "Freeman Fang" <[EMAIL PROTECTED]> wrote:
>>> Hi Vijay,
>>> 
>>> We have mtom demo in the kit, which shows how SOAP message
>>> with an attachment and XML-binary Optimized Packaging(mtom)  work.
>>> 
>>> Regards
>>> 
>>> Freeman
>>> 
>>> Vijay Allam wrote:
>>>> I have a third part webservice that returns an attachment. How do I
>>>> get the attachment with CXF client. Any example code is apreciated.
>>>> 
>>>> --Vijay
> 
> 



Re: SoapWithAttachments

2008-04-04 Thread Vijay Allam
In this case I do not have element that represents the attachment in WSDL.
It comes as part of the Soap message as multi part attachment. So not sure
how do I get the attachment. I could only find code that can easily get
attachment using axis1.1 for the request.

--Vijay


On 4/3/08 7:58 PM, "Freeman Fang" <[EMAIL PROTECTED]> wrote:

> Hi Vijay,
> 
> We have mtom demo in the kit, which shows how SOAP message
> with an attachment and XML-binary Optimized Packaging(mtom)  work.
> 
> Regards
> 
> Freeman
> 
> Vijay Allam wrote:
>> I have a third part webservice that returns an attachment. How do I get the
>> attachment with CXF client. Any example code is apreciated.
>> 
>> --Vijay 
>> 
>> On 4/3/08 9:57 AM, "Cencio" <[EMAIL PROTECTED]> wrote:
>> 
>>   
>>> Hi,
>>> 
>>> i'm still unable to retrieve the wsdl from my service... i post all my info:
>>> 
>>> web.xml:
>>> 
>>> 
>>> 
>>> contextConfigLocation
>>> WEB-INF/beans.xml
>>> 
>>> 
>>> 
>>> 
>>>
>>> org.springframework.web.context.ContextLoaderListener
>>> 
>>> 
>>> 
>>> 
>>> CXFServlet
>>> CXF Servlet
>>> 
>>> org.apache.cxf.transport.servlet.CXFServlet
>>> 
>>> 1
>>> 
>>> 
>>> 
>>> CXFServlet
>>> /*
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> beans.xml:
>>> 
>>> http://www.springframework.org/schema/beans";
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xmlns:jaxws="http://cxf.apache.org/jaxws";
>>> xsi:schemaLocation="
>>> http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>
>>> 
>>> 
>>> 
>>> 
>>> >> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>> >> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> >>   id="ese5"
>>>   address="ordine"
>>>   implementor="org.rivenditore.ordine.OrdineInterfaceImpl" />
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ordine.wsdl
>>> 
>>> 
>>> 
>>> >>xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>>>xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>>>xmlns:ele="http://www.rivenditore.org/ordiniElements";
>>>xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>>>xmlns:ord="http://www.rivenditore.org/Ordine";
>>>targetNamespace="http://www.rivenditore.org/Ordine";>
>>> 
>>> http://www.rivenditore.org/submitOrdineTypes";
>>> location="submitOrdine.xsd" />
>>> 
>>> 
>>> >> targetNamespace="http://www.rivenditore.org/ordiniElements";
>>>xmlns:soType="http://www.rivenditore.org/submitOrdineTypes";>
>>>
>>>
>>>
>>> 
>>> 
>>> 
>>>
>>>   
>>>
>>> 
>>> 
>>>
>>>   
>>>
>>> 
>>>
>>>   
>>>
>>> 
>>>
>>> 
>>>   
>>>  
>>>  
>>>   
>>> 
>>>   
>>> 
>>>   
>>> 
>>> 
>>> 
>>>
>>>   >> transport="http://schemas.xmlsoap.org/soap/http"/>
>>> 
>>>   
>>>  >> soapAction="http://www.rivenditore.org/service/ordini/#SubmitOrdine"/>
>>>  
>>> 
>>>  
>>>  
>>> 
>>>  
>>>   
>>> 
>>>   
>>>  
>>>  
>>> 
>>>  
>>>   
>>>
>>> 
>>>
>>>   >> binding="ord:OrdineInterfaceBinding">
>>>  http://localhost:8080/ese5/ordine"/>
>>>
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> submitOrdine.xsd:
>>> 
>>> 
>>> 
>>> 
>>> http://www.w3.org/2001/XMLSchema";
>>> targetNamespace="http://www.rivenditore.org/submitOrdineTypes";
>>> xmlns:so="http://www.rivenditore.org/submitOrdineTypes";>
>>> 
>>>  
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> >> use="optional"/>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> I develope both client and server using wsdl2java.
>>> 
>>> Thx for any help.
>>> 
>> 
>> 
>>   
> 



SoapWithAttachments

2008-04-03 Thread Vijay Allam

I have a third part webservice that returns an attachment. How do I get the
attachment with CXF client. Any example code is apreciated.

--Vijay 

On 4/3/08 9:57 AM, "Cencio" <[EMAIL PROTECTED]> wrote:

> 
> Hi,
> 
> i'm still unable to retrieve the wsdl from my service... i post all my info:
> 
> web.xml:
> 
> 
> 
> contextConfigLocation
> WEB-INF/beans.xml
> 
> 
> 
> 
>  
> org.springframework.web.context.ContextLoaderListener
> 
> 
> 
> 
> CXFServlet
> CXF Servlet
> 
> org.apache.cxf.transport.servlet.CXFServlet
> 
> 1
> 
> 
> 
> CXFServlet
> /*
> 
> 
> 
> 
> 
> 
> 
> 
> beans.xml:
> 
> http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:jaxws="http://cxf.apache.org/jaxws";
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>
> 
> 
> 
> 
>  class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>  class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>id="ese5"
>   address="ordine"
>   implementor="org.rivenditore.ordine.OrdineInterfaceImpl" />
> 
> 
> 
> 
> 
> 
> 
> ordine.wsdl
> 
> 
> 
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>xmlns:ele="http://www.rivenditore.org/ordiniElements";
>xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>xmlns:ord="http://www.rivenditore.org/Ordine";
>targetNamespace="http://www.rivenditore.org/Ordine";>
> 
> http://www.rivenditore.org/submitOrdineTypes";
> location="submitOrdine.xsd" />
> 
> 
>  targetNamespace="http://www.rivenditore.org/ordiniElements";
>xmlns:soType="http://www.rivenditore.org/submitOrdineTypes";>
>
>
>
> 
> 
> 
>
>   
>
> 
> 
>
>   
>
> 
>
>   
>
> 
>
> 
>   
>  
>  
>   
> 
>   
> 
>   
> 
> 
> 
>
>transport="http://schemas.xmlsoap.org/soap/http"/>
> 
>   
>   soapAction="http://www.rivenditore.org/service/ordini/#SubmitOrdine"/>
>  
> 
>  
>  
> 
>  
>   
> 
>   
>  
>  
> 
>  
>   
>
> 
>
>binding="ord:OrdineInterfaceBinding">
>  http://localhost:8080/ese5/ordine"/>
>
>
> 
> 
> 
> 
> 
> 
> 
> submitOrdine.xsd:
> 
> 
> 
> 
> http://www.w3.org/2001/XMLSchema";
> targetNamespace="http://www.rivenditore.org/submitOrdineTypes";
> xmlns:so="http://www.rivenditore.org/submitOrdineTypes";>
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  use="optional"/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I develope both client and server using wsdl2java.
> 
> Thx for any help.