Hello,
I am trying to figure out how to use OFBiz web services through SOAP using C# (.NET 2.0 Visual Studio 2005). I was wondering if this is a know issue? Any kind of direction on how I can fix this will be great? There are several things I tried to do unsuccessfully. I created a simple Ofbiz Service that takes three string arguments and return one string. 1) When I try to add Web Reference using WSE 3.0 to my .NET project, the auto generated proxy has the following error // CODEGEN: The operation binding 'addWorkflowStep' from namespace 'http://www.ofbiz.org/service/' was ignored. Specifying a type for use=literal messages is not supported. and it doesn't contain the code for the actual web service invocation 2) I tried to modify the WSDL (on the local file system) and added the Web Reference using the Modified wsdl, first I got the following error when I tried to contact the service System.Web.Services.Protocols.SoapException: Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapCl ientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at SimpleConsoleClient.WF.addWorkflowStep.CalladdWorkflowStep(String id, String applicationId) in C:\DocumentsandSettings\FPAdmin\Desktop\SRX0703 07601425_Maria\SimpleConsoleClient\SimpleConsoleClient\Web References\WF\Reference.cs:line 79 at SimpleConsoleClient.Program.Display() in C:\Documents and Settings\FPAdmin\Desktop\SRX070307601425_Maria\SimpleConsoleClient\Simpl eConsoleClient\Program.cs:line 62 at SimpleConsoleClient.Program.DoWork(Trap action) in C:\Documents and Settings\FPAdmin\Desktop\SRX070307601425_Maria\SimpleConsoleClient\Simpl eConsoleClient\Program.cs:line 20 3) Modifying the proxy and the wsdl file some more I was able to call ofbiz service, (I tracked the packages and was able to see the request and the response), but I was not able to read the response back. I am keep getting object array of one element that is null. POST http://storm.wcpub.es.xerox.com:8080/webtools/control/SOAPService HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42) Content-Type: text/xml; charset=utf-8 SOAPAction: "http://schemas.xmlsoap.org/soap/http" Host: storm.wcpub.es.xerox.com:8080 Content-Length: 392 Expect: 100-continue Proxy-Connection: Keep-Alive HTTP/1.1 100 Continue <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><addWorkflowStep xmlns="http://www.ofbiz.org/service/"><id>10000</id><applicationId>blah< /applicationId><domainId>foo</domainId></addWorkflowStep></soap:Body></s oap:Envelope>HTTP/1.0 200 OK Proxy-Connection: Keep-Alive Connection: Keep-Alive Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Content-Length: 629 Date: Wed, 21 Mar 2007 22:16:17 GMT Set-Cookie: JSESSIONID=2CD21B90923A7153982DE1A28ADFFD08.jvm1; Path=/webtools Set-Cookie: OFBiz.Visitor=10306; Expires=Thu, 20-Mar-2008 22:16:18 GMT; Path=/ <?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> <ns1:addWorkflowStepResponse xmlns:ns1="http://www.ofbiz.org/service/"> <workflowStepId xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">10016</workflo wStepId> <responseMessage xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">success</respo nseMessage> </ns1:addWorkflowStepResponse> </soapenv:Body> </soapenv:Envelope> 4) I used my project to connect to Axis service and it works fine I am getting a response back and I am able to read it. 5) I also tried to contact ofbiz service thru java eclipse project, also not successfully. Thanks a lot, Marina |
Hi Marina,
> There are several things I tried to do unsuccessfully. I created a > simple Ofbiz Service that takes three string arguments and return one > string. > Perhaps the existing http service can do the same thing? https://localhost:8443/webtools/control/availableServices?constraint=engine_name@http There is a testHttp service as an example in OFBiz: http://localhost:8080/webtools/control/httpService Regards, Shi Jinghai/Beijing Langhua Ltd. |
Administrator
|
In reply to this post by Cholakyan, Marina
Please have a look at http://tinyurl.com/yqsqro
Jacques I am trying to figure out how to use OFBiz web services through SOAP using C# (.NET 2.0 Visual Studio 2005). I was wondering if this is a know issue? Any kind of direction on how I can fix this will be great? There are several things I tried to do unsuccessfully. I created a simple Ofbiz Service that takes three string arguments and return one string. 1) When I try to add Web Reference using WSE 3.0 to my .NET project, the auto generated proxy has the following error // CODEGEN: The operation binding 'addWorkflowStep' from namespace 'http://www.ofbiz.org/service/' was ignored. Specifying a type for use=literal messages is not supported. and it doesn't contain the code for the actual web service invocation 2) I tried to modify the WSDL (on the local file system) and added the Web Reference using the Modified wsdl, first I got the following error when I tried to contact the service System.Web.Services.Protocols.SoapException: Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapCl ientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at SimpleConsoleClient.WF.addWorkflowStep.CalladdWorkflowStep(String id, String applicationId) in C:\DocumentsandSettings\FPAdmin\Desktop\SRX0703 07601425_Maria\SimpleConsoleClient\SimpleConsoleClient\Web References\WF\Reference.cs:line 79 at SimpleConsoleClient.Program.Display() in C:\Documents and Settings\FPAdmin\Desktop\SRX070307601425_Maria\SimpleConsoleClient\Simpl eConsoleClient\Program.cs:line 62 at SimpleConsoleClient.Program.DoWork(Trap action) in C:\Documents and Settings\FPAdmin\Desktop\SRX070307601425_Maria\SimpleConsoleClient\Simpl eConsoleClient\Program.cs:line 20 3) Modifying the proxy and the wsdl file some more I was able to call ofbiz service, (I tracked the packages and was able to see the request and the response), but I was not able to read the response back. I am keep getting object array of one element that is null. POST http://storm.wcpub.es.xerox.com:8080/webtools/control/SOAPService HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42) Content-Type: text/xml; charset=utf-8 SOAPAction: "http://schemas.xmlsoap.org/soap/http" Host: storm.wcpub.es.xerox.com:8080 Content-Length: 392 Expect: 100-continue Proxy-Connection: Keep-Alive HTTP/1.1 100 Continue <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><addWorkflowStep xmlns="http://www.ofbiz.org/service/"><id>10000</id><applicationId>blah< /applicationId><domainId>foo</domainId></addWorkflowStep></soap:Body></s oap:Envelope>HTTP/1.0 200 OK Proxy-Connection: Keep-Alive Connection: Keep-Alive Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Content-Length: 629 Date: Wed, 21 Mar 2007 22:16:17 GMT Set-Cookie: JSESSIONID=2CD21B90923A7153982DE1A28ADFFD08.jvm1; Path=/webtools Set-Cookie: OFBiz.Visitor=10306; Expires=Thu, 20-Mar-2008 22:16:18 GMT; Path=/ <?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> <ns1:addWorkflowStepResponse xmlns:ns1="http://www.ofbiz.org/service/"> <workflowStepId xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">10016</workflo wStepId> <responseMessage xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">success</respo nseMessage> </ns1:addWorkflowStepResponse> </soapenv:Body> </soapenv:Envelope> 4) I used my project to connect to Axis service and it works fine I am getting a response back and I am able to read it. 5) I also tried to contact ofbiz service thru java eclipse project, also not successfully. Thanks a lot, Marina |
In reply to this post by Cholakyan, Marina
I had very similar problems connecting .NET and OFBiz SOAP exported
services. Someone (I forget who), explained that OFBiz SOAP support is very primitive at the moment, and does not support complex types. However even when I tried it with simple types it did not work! There was a discussion about this a while back on the list and everyone was having the same problem. Someone suggested using WSDL4J to generate an adequate WSDL, when I go back to this topic I will try using this tool. If I have any success I will post here. cameron ___________________________________________________________ Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html |
Hi,
Thanks for quick responses! I found a quick solution, since I am newbie in the whole SOAP, WSDL, Web Services stuff probably not the best solution, but here it is... When I used WSE in .NET 2.0 and tried to add Web Reference (where you specify the Web Service url) and Visual Studio generates the proxy/client code for the service invocation and sets the message style to Document for Web service method. It goes something like this ... [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace = "http://www.ofbiz.org/service/", ResponseNamespace = "http://www.ofbiz.org/service/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public String yourServiceName(String arg) { object[] result = this.Invoke("yourServiceName ", new object[0] {arg}); return (string)result[0]; } ... Since it is hard to realize what is ofbiz's WSDL SOAP message is formatted in (RPC or Document) style. I just in case tried to use RPC and it worked so I replace the code above with. ... [SoapRpcMethod()] public String yourServiceName(String arg) { object[] result = this.Invoke("yourServiceName ", new object[0] {arg}); return (string)result[0]; } ... So I didn't use Visual Studio's auto generated proxy and Web Reference, I just wrote my own client, which is not different from auto generated code except the changes above. Marina |
Free forum by Nabble | Edit this page |