You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snowc <ch...@gmail.com> on 2009/08/24 14:55:44 UTC

external soap service

I'm trying to call an external soap service.  My service definition is:

	<service name="HpiLookup" engine="soap"
			location="http://www.q.hpi.co.uk/tradeservice/servlet/messagerouter" 
			invoke="enquire">

 		<namespace>urn:enquiry</namespace>
        <attribute name="message" type="String" mode="IN"/>
        <attribute name="result" type="String" mode="OUT"/>
	</service>

My bsh:

delegator = GenericDelegator.getGenericDelegator("default");
dispatcher = GenericDispatcher.getLocalDispatcher("mydelegator", delegator);
userLogin = delegator.findByPrimaryKey("UserLogin",
UtilMisc.toMap("userLoginId", "admin"));

message = 
"<hpi:enquire xmlns:hpi=\"urn:enquiry\">" +
" <hpi:Authentication>" +
"     <hpi:CustomerDetails>" +
"         <hpi:CustomerCode>CUSTCODE</hpi:CustomerCode>" +
"         <hpi:Initials>CC</hpi:Initials>" +
"         <hpi:Password>PASSWORD</hpi:Password>" +
"     </hpi:CustomerDetails>" +
" </hpi:Authentication>" +
" <hpi:Request>" +
"     <hpi:Asset>" +
"        <hpi:Vrm></hpi:Vrm>" +
"			<hpi:Vin></hpi:Vin>" +
"     </hpi:Asset>" +
"     <hpi:Product>" +
"         <hpi:Code></hpi:Code>" +
"     </hpi:Product>" +
" </hpi:Request>" +
"</hpi:enquire>";

Map serviceCtx = UtilMisc.toMap("message", message, "userLogin", userLogin);
resultMap = dispatcher.runSync("HpiLookup", serviceCtx);

--------------------------

The message input attribute is getting encoded (see below), but I just want
to send the message as a raw string.  Is this possible? Many thanks in
advance...

POST /tradeservice/servlet/messagerouter HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: www.q.hpi.co.uk
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 948

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><enquire
xmlns=""><message xsi:type="xsd:string">&lt;hpi:enquire
xmlns:hpi=&quot;urn:enquiry&quot;&gt; &lt;hpi:Authentication&gt;    
&lt;hpi:CustomerDetails&gt;        
&lt;hpi:CustomerCode&gt;CUSTCODE&lt;/hpi:CustomerCode&gt;        
&lt;hpi:Initials&gt;CC&lt;/hpi:Initials&gt;        
&lt;hpi:Password&gt;PASSWORD&lt;/hpi:Password&gt;    
&lt;/hpi:CustomerDetails&gt; &lt;/hpi:Authentication&gt; &lt;hpi:Request&gt;    
&lt;hpi:Asset&gt;       
&lt;hpi:Vrm&gt;&lt;/hpi:Vrm&gt;...&lt;hpi:Vin&gt;&lt;/hpi:Vin&gt;    
&lt;/hpi:Asset&gt;     &lt;hpi:Product&gt;        
&lt;hpi:Code&gt;&lt;/hpi:Code&gt;     &lt;/hpi:Product&gt;
&lt;/hpi:Request&gt;&lt;/hpi:enquire&gt;</message></enquire></soapenv:Body></soapenv:Envelope>

-- 
View this message in context: http://www.nabble.com/external-soap-service-tp25115630p25115630.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: external soap service

Posted by Mridul Pathak <mr...@hotwaxmedia.com>.
Hi Chris,
    You can refer specialpurpose/oagis component for other examples of OFBiz
interacting with web services.  For example, oagisSendConfirmBod,
oagisSendReceiveDelivery, oagisSendProcessShipment, etc.  All these services
post xml templates as streams to external web services.  There are other
examples in USPSSevices.java file as well.  Hope that helps.

-- 
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
mridul.pathak@hotwaxmedia.com

On Mon, Aug 24, 2009 at 7:19 PM, snowc <ch...@gmail.com> wrote:

>
> Hi Vivek,
>
> I'm trying to call a web service outside of ofbiz where ofbiz is the client
> to that web service.  I am not trying to export my code as a web service.
>
> Cheers,
>
> Chris
>
>
> Vivek Mishra-2 wrote:
> >
> > Hi,
> >
> > This link may help you to understand the concept
> >
> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP+using+AXIS2
> >
> > Thanks and Regards,
> > --
> > Vivek Mishra
> >
> > snowc wrote:
> >> I'm trying to call an external soap service.  My service definition is:
> >>
> >>      <service name="HpiLookup" engine="soap"
> >>                      location="
> http://www.q.hpi.co.uk/tradeservice/servlet/messagerouter"
> >>                      invoke="enquire">
> >>
> >>              <namespace>urn:enquiry</namespace>
> >>         <attribute name="message" type="String" mode="IN"/>
> >>         <attribute name="result" type="String" mode="OUT"/>
> >>      </service>
> >>
> >> My bsh:
> >>
> >> delegator = GenericDelegator.getGenericDelegator("default");
> >> dispatcher = GenericDispatcher.getLocalDispatcher("mydelegator",
> >> delegator);
> >> userLogin = delegator.findByPrimaryKey("UserLogin",
> >> UtilMisc.toMap("userLoginId", "admin"));
> >>
> >> message =
> >> "<hpi:enquire xmlns:hpi=\"urn:enquiry\">" +
> >> " <hpi:Authentication>" +
> >> "     <hpi:CustomerDetails>" +
> >> "         <hpi:CustomerCode>CUSTCODE</hpi:CustomerCode>" +
> >> "         <hpi:Initials>CC</hpi:Initials>" +
> >> "         <hpi:Password>PASSWORD</hpi:Password>" +
> >> "     </hpi:CustomerDetails>" +
> >> " </hpi:Authentication>" +
> >> " <hpi:Request>" +
> >> "     <hpi:Asset>" +
> >> "        <hpi:Vrm></hpi:Vrm>" +
> >> "                    <hpi:Vin></hpi:Vin>" +
> >> "     </hpi:Asset>" +
> >> "     <hpi:Product>" +
> >> "         <hpi:Code></hpi:Code>" +
> >> "     </hpi:Product>" +
> >> " </hpi:Request>" +
> >> "</hpi:enquire>";
> >>
> >> Map serviceCtx = UtilMisc.toMap("message", message, "userLogin",
> >> userLogin);
> >> resultMap = dispatcher.runSync("HpiLookup", serviceCtx);
> >>
> >> --------------------------
> >>
> >> The message input attribute is getting encoded (see below), but I just
> >> want
> >> to send the message as a raw string.  Is this possible? Many thanks in
> >> advance...
> >>
> >> POST /tradeservice/servlet/messagerouter HTTP/1.0
> >> Content-Type: text/xml; charset=utf-8
> >> Accept: application/soap+xml, application/dime, multipart/related,
> text/*
> >> User-Agent: Axis/1.4
> >> Host: www.q.hpi.co.uk
> >> Cache-Control: no-cache
> >> Pragma: no-cache
> >> SOAPAction: ""
> >> Content-Length: 948
> >>
> >> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> "><soapenv:Body><enquire
> >> xmlns=""><message xsi:type="xsd:string">&lt;hpi:enquire
> >> xmlns:hpi=&quot;urn:enquiry&quot;&gt; &lt;hpi:Authentication&gt;
> >> &lt;hpi:CustomerDetails&gt;
> >> &lt;hpi:CustomerCode&gt;CUSTCODE&lt;/hpi:CustomerCode&gt;
> >> &lt;hpi:Initials&gt;CC&lt;/hpi:Initials&gt;
> >> &lt;hpi:Password&gt;PASSWORD&lt;/hpi:Password&gt;
> >> &lt;/hpi:CustomerDetails&gt; &lt;/hpi:Authentication&gt;
> >> &lt;hpi:Request&gt;
> >> &lt;hpi:Asset&gt;
> >> &lt;hpi:Vrm&gt;&lt;/hpi:Vrm&gt;...&lt;hpi:Vin&gt;&lt;/hpi:Vin&gt;
> >> &lt;/hpi:Asset&gt;     &lt;hpi:Product&gt;
> >> &lt;hpi:Code&gt;&lt;/hpi:Code&gt;     &lt;/hpi:Product&gt;
> >>
> &lt;/hpi:Request&gt;&lt;/hpi:enquire&gt;</message></enquire></soapenv:Body></soapenv:Envelope>
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/external-soap-service-tp25115630p25116391.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>

Re: external soap service

Posted by snowc <ch...@gmail.com>.
Hi Vivek,

I'm trying to call a web service outside of ofbiz where ofbiz is the client
to that web service.  I am not trying to export my code as a web service.

Cheers,

Chris


Vivek Mishra-2 wrote:
> 
> Hi,
> 
> This link may help you to understand the concept
> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP+using+AXIS2
> 
> Thanks and Regards,
> --
> Vivek Mishra
> 
> snowc wrote:
>> I'm trying to call an external soap service.  My service definition is:
>>
>> 	<service name="HpiLookup" engine="soap"
>> 			location="http://www.q.hpi.co.uk/tradeservice/servlet/messagerouter" 
>> 			invoke="enquire">
>>
>>  		<namespace>urn:enquiry</namespace>
>>         <attribute name="message" type="String" mode="IN"/>
>>         <attribute name="result" type="String" mode="OUT"/>
>> 	</service>
>>
>> My bsh:
>>
>> delegator = GenericDelegator.getGenericDelegator("default");
>> dispatcher = GenericDispatcher.getLocalDispatcher("mydelegator",
>> delegator);
>> userLogin = delegator.findByPrimaryKey("UserLogin",
>> UtilMisc.toMap("userLoginId", "admin"));
>>
>> message = 
>> "<hpi:enquire xmlns:hpi=\"urn:enquiry\">" +
>> " <hpi:Authentication>" +
>> "     <hpi:CustomerDetails>" +
>> "         <hpi:CustomerCode>CUSTCODE</hpi:CustomerCode>" +
>> "         <hpi:Initials>CC</hpi:Initials>" +
>> "         <hpi:Password>PASSWORD</hpi:Password>" +
>> "     </hpi:CustomerDetails>" +
>> " </hpi:Authentication>" +
>> " <hpi:Request>" +
>> "     <hpi:Asset>" +
>> "        <hpi:Vrm></hpi:Vrm>" +
>> "			<hpi:Vin></hpi:Vin>" +
>> "     </hpi:Asset>" +
>> "     <hpi:Product>" +
>> "         <hpi:Code></hpi:Code>" +
>> "     </hpi:Product>" +
>> " </hpi:Request>" +
>> "</hpi:enquire>";
>>
>> Map serviceCtx = UtilMisc.toMap("message", message, "userLogin",
>> userLogin);
>> resultMap = dispatcher.runSync("HpiLookup", serviceCtx);
>>
>> --------------------------
>>
>> The message input attribute is getting encoded (see below), but I just
>> want
>> to send the message as a raw string.  Is this possible? Many thanks in
>> advance...
>>
>> POST /tradeservice/servlet/messagerouter HTTP/1.0
>> Content-Type: text/xml; charset=utf-8
>> Accept: application/soap+xml, application/dime, multipart/related, text/*
>> User-Agent: Axis/1.4
>> Host: www.q.hpi.co.uk
>> Cache-Control: no-cache
>> Pragma: no-cache
>> SOAPAction: ""
>> Content-Length: 948
>>
>> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><enquire
>> xmlns=""><message xsi:type="xsd:string">&lt;hpi:enquire
>> xmlns:hpi=&quot;urn:enquiry&quot;&gt; &lt;hpi:Authentication&gt;    
>> &lt;hpi:CustomerDetails&gt;        
>> &lt;hpi:CustomerCode&gt;CUSTCODE&lt;/hpi:CustomerCode&gt;        
>> &lt;hpi:Initials&gt;CC&lt;/hpi:Initials&gt;        
>> &lt;hpi:Password&gt;PASSWORD&lt;/hpi:Password&gt;    
>> &lt;/hpi:CustomerDetails&gt; &lt;/hpi:Authentication&gt;
>> &lt;hpi:Request&gt;    
>> &lt;hpi:Asset&gt;       
>> &lt;hpi:Vrm&gt;&lt;/hpi:Vrm&gt;...&lt;hpi:Vin&gt;&lt;/hpi:Vin&gt;    
>> &lt;/hpi:Asset&gt;     &lt;hpi:Product&gt;        
>> &lt;hpi:Code&gt;&lt;/hpi:Code&gt;     &lt;/hpi:Product&gt;
>> &lt;/hpi:Request&gt;&lt;/hpi:enquire&gt;</message></enquire></soapenv:Body></soapenv:Envelope>
>>
>>   
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/external-soap-service-tp25115630p25116391.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: external soap service

Posted by Vivek Mishra <vi...@hotwaxmedia.com>.
Hi,

This link may help you to understand the concept
http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP+using+AXIS2

Thanks and Regards,
--
Vivek Mishra

snowc wrote:
> I'm trying to call an external soap service.  My service definition is:
>
> 	<service name="HpiLookup" engine="soap"
> 			location="http://www.q.hpi.co.uk/tradeservice/servlet/messagerouter" 
> 			invoke="enquire">
>
>  		<namespace>urn:enquiry</namespace>
>         <attribute name="message" type="String" mode="IN"/>
>         <attribute name="result" type="String" mode="OUT"/>
> 	</service>
>
> My bsh:
>
> delegator = GenericDelegator.getGenericDelegator("default");
> dispatcher = GenericDispatcher.getLocalDispatcher("mydelegator", delegator);
> userLogin = delegator.findByPrimaryKey("UserLogin",
> UtilMisc.toMap("userLoginId", "admin"));
>
> message = 
> "<hpi:enquire xmlns:hpi=\"urn:enquiry\">" +
> " <hpi:Authentication>" +
> "     <hpi:CustomerDetails>" +
> "         <hpi:CustomerCode>CUSTCODE</hpi:CustomerCode>" +
> "         <hpi:Initials>CC</hpi:Initials>" +
> "         <hpi:Password>PASSWORD</hpi:Password>" +
> "     </hpi:CustomerDetails>" +
> " </hpi:Authentication>" +
> " <hpi:Request>" +
> "     <hpi:Asset>" +
> "        <hpi:Vrm></hpi:Vrm>" +
> "			<hpi:Vin></hpi:Vin>" +
> "     </hpi:Asset>" +
> "     <hpi:Product>" +
> "         <hpi:Code></hpi:Code>" +
> "     </hpi:Product>" +
> " </hpi:Request>" +
> "</hpi:enquire>";
>
> Map serviceCtx = UtilMisc.toMap("message", message, "userLogin", userLogin);
> resultMap = dispatcher.runSync("HpiLookup", serviceCtx);
>
> --------------------------
>
> The message input attribute is getting encoded (see below), but I just want
> to send the message as a raw string.  Is this possible? Many thanks in
> advance...
>
> POST /tradeservice/servlet/messagerouter HTTP/1.0
> Content-Type: text/xml; charset=utf-8
> Accept: application/soap+xml, application/dime, multipart/related, text/*
> User-Agent: Axis/1.4
> Host: www.q.hpi.co.uk
> Cache-Control: no-cache
> Pragma: no-cache
> SOAPAction: ""
> Content-Length: 948
>
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><enquire
> xmlns=""><message xsi:type="xsd:string">&lt;hpi:enquire
> xmlns:hpi=&quot;urn:enquiry&quot;&gt; &lt;hpi:Authentication&gt;    
> &lt;hpi:CustomerDetails&gt;        
> &lt;hpi:CustomerCode&gt;CUSTCODE&lt;/hpi:CustomerCode&gt;        
> &lt;hpi:Initials&gt;CC&lt;/hpi:Initials&gt;        
> &lt;hpi:Password&gt;PASSWORD&lt;/hpi:Password&gt;    
> &lt;/hpi:CustomerDetails&gt; &lt;/hpi:Authentication&gt; &lt;hpi:Request&gt;    
> &lt;hpi:Asset&gt;       
> &lt;hpi:Vrm&gt;&lt;/hpi:Vrm&gt;...&lt;hpi:Vin&gt;&lt;/hpi:Vin&gt;    
> &lt;/hpi:Asset&gt;     &lt;hpi:Product&gt;        
> &lt;hpi:Code&gt;&lt;/hpi:Code&gt;     &lt;/hpi:Product&gt;
> &lt;/hpi:Request&gt;&lt;/hpi:enquire&gt;</message></enquire></soapenv:Body></soapenv:Envelope>
>
>