You need to sign in to do that
Don't have an account?
Scooter429
Visualforce - RPC WSDL Style
It appears that the "RPC" WSDL style is not presently supported by Visualforce. Can someone please point me to the documentation on WSDL models supported by Visualforce. More importantly what is the guidance for incorporating RPC-based WSDLs ?
We are presently getting the following error message.
Error: Failed to parse wsdl: Unsupported WSDL style 'rpc'. Only supports Dcoument/litteral/wrapped services.
A WSDL document describes a Web service. A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol. A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use. This gives you four style/use models. Add to this collection a pattern which is commonly called the document/literal wrapped pattern and you have five binding styles to choose from when creating a WSDL file.
1. RPC/encoded
2. RPC/literal
3. Document/encoded
4. Document/literal
5. Document/literal wrapped
* Reference: http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
We are presently getting the following error message.
Error: Failed to parse wsdl: Unsupported WSDL style 'rpc'. Only supports Dcoument/litteral/wrapped services.
A WSDL document describes a Web service. A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol. A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use. This gives you four style/use models. Add to this collection a pattern which is commonly called the document/literal wrapped pattern and you have five binding styles to choose from when creating a WSDL file.
1. RPC/encoded
2. RPC/literal
3. Document/encoded
4. Document/literal
5. Document/literal wrapped
* Reference: http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
You can use the Http, HttpRequest, XmlStreamWriter and XmlStreamReader classes
to hand code your web service invoke. Then you can invoke any http endpoint using this
(need not be web service). It will be lot more code than using wsdl2apex.
HTHs,
Message Edited by Harmpie on 11-19-2008 06:49 AM
I just ran into this problem, is there a solution other than hand coding and parsing the soap requests and responses?
Having the same problem here. I would like to integrate with a web service that is described with an "RPC" style WSDL. Will this style be supported by force.com? Are there ways of converted an RPC WSDL to the style that force.com understands?
Cheers,
Martin
To address a webservice that uses this type of wsdl is impossible by consuming the WSDL. In my case I used a http callout to the service, passing the parameters by url.
My class code:
global class TestWsClass { public static integer debug = 0; private static final string serviceUrl = 'https://ws1.webservices.nl/rpc/get-simplexml/internationalAddressSearchV2/<username>/<password>'; @future (callout=true) public static void doRequest(list<string> accids) { Account[] al = [ select Id, Name, BillingStreet,BillingState,BillingPostalCode,BillingCountry,Debug__c from Account where id in :accids LIMIT 200]; List<Account> updAcc = new List<Account>(); for (Account a: al) { String addressString = ''; if(a.Name!=null) { if(a.Name.length() > 0) { addressString += '/'+EncodingUtil.urlEncode(a.Name,'UTF-8'); } else { addressString += '/'; } } else { addressString += '/'; } // Use street as both Building and Address (and housenumer, which is not a default SFDC field) AND PO BOX if(a.BillingStreet!=null) { if(a.BillingStreet.length() > 0) { addressString += '/'+EncodingUtil.urlEncode(a.BillingStreet,'UTF-8')+'/'+EncodingUtil.urlEncode(a.BillingStreet,'UTF-8')+'/'+EncodingUtil.urlEncode(a.BillingStreet,'UTF-8')+'/'; } else { addressString += '////'; } } else { addressString += '////'; } // Locality = empty addressString += '/'; if(a.BillingPostalCode!=null) { if(a.BillingPostalCode.length() > 0) { addressString += '/'+EncodingUtil.urlEncode(a.BillingPostalCode,'UTF-8'); } else { addressString += '/'; } } else { addressString += '/'; } if(a.BillingState!=null) { if(a.BillingState.length() > 0) { addressString += '/'+EncodingUtil.urlEncode(a.BillingState,'UTF-8'); } else { addressString += '/'; } } else { addressString += '/'; } if(a.BillingCountry!=null) { if(a.BillingCountry.length() > 0) { addressString += '/'+EncodingUtil.urlEncode(a.BillingCountry,'UTF-8'); }else { addressString += '/'; } } else { addressString += '/'; } addressString += '/nl/nl'; xmldom dom = checkAddress(addressString,a); if(dom!=null) { System.debug('TESTING:'+dom.root.getValue('formatted_address')); a.Debug__c = dom.root.getValue('formatted_address'); updAcc.add(a); } } if(updAcc.size()>0) { update updAcc; } } public static xmldom checkAddress(String addr,Account a) { HttpRequest req = new HttpRequest(); //string url = TestWsClass.serviceUrl + EncodingUtil.urlEncode(addr,'UTF-8'); string url = TestWsClass.serviceUrl + addr; req.setEndpoint( url ); req.setMethod('GET'); xmldom dom = null; try { Http http = new Http(); HttpResponse response = http.send(req); System.Debug('STATUS:'+response.getStatusCode()); if (response.getStatusCode() != 200 ) { System.Debug('Response for '+url+':'+response); } else { dom = new xmldom(response.getBody()); System.Debug('URL:'+url); System.Debug('DOM:'+dom.toXmlString()); System.Debug('Postcode:'+dom.root.getValue('postcode')); System.Debug('Formatted address:'+dom.root.getValue('formatted_address')); //a.Debug__c = dom.root.getValue('formatted_address'); } } catch( System.Exception e) { System.Debug('Exception!!:'+e.getMessage()); } if ( TestWsClass.debug > 0 && dom != null ) { dom.dumpAll(); } return dom; } private static void dumpResponse(HttpResponse response) { xmldom dom = new xmldom( response.getBody() ); dom.dumpAll(); } }
and the trigger calling it
trigger testWs on Account (after update) { string[] todo = new string[]{}; if(Trigger.new[0].BillingPostalCode != Trigger.old[0].BillingPostalCode) { for (Account acc : Trigger.New) { todo.add((String)acc.Id); } TestWsClass.doRequest(todo); } }
Thanks for the response Harmpie,
I actually ended up doing a similar thing with http requests and the excellent XMLDom class. In some ways it's probably more effecient since you only need to implement the parts of the wsdl that you need so the code ends up with a smaller footprint. I suppose this advantage dimishes as you require more and more of the operations provided by the service. Either way it's a pain writing the code by hand. Auto generated by wsdl2apex or even better generated at runtime like the PHP library would be great.
for my case,i have to integrate salesforce with magento which uses a wsdl with format RPC/encoded. I have the architecture of the wsdl, and i also have to url which end with the extension wsdl.As salesforce do not understand RPC?encoded i was skipping the part of wsdl2Apex and i am trying the HTTP callout as you suggested. but i do not know where to start.I need to calla method from the wsdl with 3 parameters a username,a pwd and an id ,and expect to get a list of info.
1. which url to use for the endpoint? the same as wsdl soap:address e.g http://192.168.1.31/soap/xx_reservation.php or to the wsdl itself : http://arianetest.smartbox.com/soap/xx_reservation.wsdl??
2. How do i call the method from HTTP Callout???
3. How do i pass a parameter to the function call??
thanks in anticipation for future replies.
Hi,
I'm having a similar issue. Were you able to solve yours?
Thanks,
kpr
No,thus we did the other way. I created a webservice in salesforce and write the other side code in php using the php toolkit library to call the webservice.