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"><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></message></enquire></soapenv:Body></soapenv:Envelope> |
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"><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></message></enquire></soapenv:Body></soapenv:Envelope> > > smime.p7s (4K) Download Attachment |
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
|
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 [hidden email] On Mon, Aug 24, 2009 at 7:19 PM, snowc <[hidden email]> 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"><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></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. > > |
Free forum by Nabble | Edit this page |