Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]"
------------------------------------------------------------------------------------------------------------ Key: OFBIZ-3385 URL: https://issues.apache.org/jira/browse/OFBIZ-3385 Project: OFBiz Issue Type: Bug Components: framework Affects Versions: SVN trunk Reporter: chris snow I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. I received the following error message: {code} com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at $Proxy28.findPartiesById(Unknown Source) at javaapplication7.Main.main(Main.java:74) {code} Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: {code} <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> <map-Map> <ns2:map-Entry> <ns2:map-Key> <ns2:std-String value="idToFind"/> </ns2:map-Key> <ns2:map-Value> <ns2:std-String value="admin"/> </ns2:map-Value> </ns2:map-Entry> <ns2:map-Entry> <ns2:map-Key> <ns2:std-String value="login.username"/> </ns2:map-Key> <ns2:map-Value> <ns2:std-String value="admin"/> </ns2:map-Value> </ns2:map-Entry> <ns2:map-Entry> <ns2:map-Key> <ns2:std-String value="login.password"/> </ns2:map-Key> <ns2:map-Value> <ns2:std-String value="ofbiz"/> </ns2:map-Value> </ns2:map-Entry> </map-Map> </ns2:findPartiesById> </S:Body> </S:Envelope> {code} If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: {code} <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> <map-Map> <map-Entry> <map-Key> <std-String value="idToFind"/> </map-Key> <map-Value> <std-String value="admin"/> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="login.username"/> </map-Key> <map-Value> <std-String value="admin"/> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="login.password"/> </map-Key> <map-Value> <std-String value="ofbiz"/> </map-Value> </map-Entry> </map-Map> </ns2:findPartiesById> </S:Body> </S:Envelope> {code} My java class is: {code} package javaapplication7; import org.apache.ofbiz.service.MapEntry; import org.apache.ofbiz.service.MapKey; import org.apache.ofbiz.service.MapMap; import org.apache.ofbiz.service.MapValue; import org.apache.ofbiz.service.StdString; public class Main { public static void main(String[] args) { try { org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); StdString keyString = new StdString(); keyString.setValue("idToFind"); MapKey mapKey = new MapKey(); mapKey.setStdString(keyString); StdString valueString = new StdString(); valueString.setValue("admin"); MapValue mapValue = new MapValue(); mapValue.setStdString(valueString); MapEntry mapEntry = new MapEntry(); mapEntry.setMapKey(mapKey); mapEntry.setMapValue(mapValue); StdString keyStringLogin = new StdString(); keyStringLogin.setValue("login.username"); MapKey mapKeyLogin = new MapKey(); mapKeyLogin.setStdString(keyStringLogin); StdString valueStringLogin = new StdString(); valueStringLogin.setValue("admin"); MapValue mapValueLogin = new MapValue(); mapValueLogin.setStdString(valueStringLogin); MapEntry mapEntryLogin = new MapEntry(); mapEntryLogin.setMapKey(mapKeyLogin); mapEntryLogin.setMapValue(mapValueLogin); StdString keyStringPassword = new StdString(); keyStringPassword.setValue("login.password"); MapKey mapKeyPassword = new MapKey(); mapKeyPassword.setStdString(keyStringPassword); StdString valueStringPassword = new StdString(); valueStringPassword.setValue("ofbiz"); MapValue mapValuePassword = new MapValue(); mapValuePassword.setStdString(valueStringPassword); MapEntry mapEntryPassword = new MapEntry(); mapEntryPassword.setMapKey(mapKeyPassword); mapEntryPassword.setMapValue(mapValuePassword); MapMap myMap = new MapMap(); myMap.getMapEntry().add(mapEntry); myMap.getMapEntry().add(mapEntryLogin); myMap.getMapEntry().add(mapEntryPassword); javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); port.findPartiesById(mapMap); } catch (Exception ex) { ex.printStackTrace(); } } } {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794915#action_12794915 ] chris snow commented on OFBIZ-3385: ----------------------------------- I modified the SOAPEventHandler sendError method to set the content type to text/xml: {code} public class SOAPEventHandler implements EventHandler { ... private void sendError(HttpServletResponse res, String errorMessage) throws EventHandlerException { try { // setup the response res.setContentType("text/xml"); ... {code} This has resolved the content type error message, but I now get the following error message: {code} javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse at com.sun.xml.internal.ws.client.sei.ResponseBuilder$RpcLit.readResponse(ResponseBuilder.java:603) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at $Proxy28.findPartiesById(Unknown Source) at javaapplication7.Main.main(Main.java:74) {code} It seems that the service is expecting the login.username and login.password parameters, but because of the namespace issue isn't detecting them from the request. Instead of returning the error in a <findPartiesByIdResponse> element, the service is returning the error in a generic <Response> element. {code} <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body> <Response> <map-Map> <map-Entry> <map-Key> <std-String value="errorMessage"></std-String> </map-Key> <map-Value> <std-String value="Problem processing the service"></std-String> </map-Value> </map-Entry> </map-Map> </Response> </soapenv:Body> </soapenv:Envelope> {code} > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794915#action_12794915 ] chris snow edited comment on OFBIZ-3385 at 12/28/09 8:32 PM: ------------------------------------------------------------- I modified the SOAPEventHandler sendError method to set the content type to text/xml: {code} public class SOAPEventHandler implements EventHandler { ... private void sendError(HttpServletResponse res, String errorMessage) throws EventHandlerException { try { // setup the response res.setContentType("text/xml"); ... {code} This has resolved the content type error message, but I now get the following error message: {code} javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse at com.sun.xml.internal.ws.client.sei.ResponseBuilder$RpcLit.readResponse(ResponseBuilder.java:603) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at $Proxy28.findPartiesById(Unknown Source) at javaapplication7.Main.main(Main.java:74) {code} It seems that the service is expecting the login.username and login.password parameters, but because of the namespace issue isn't detecting them from the request. Instead of returning the error in a <findPartiesByIdResponse> element, the service is returning the error in a generic <Response> element. It also looks like two response's are being returned? {code} HTTP/1.1 200 OK Date: Mon, 28 Dec 2009 20:15:22 GMT Set-Cookie: JSESSIONID=484E688A4DC10B5504C9035B4AA3C1EF.jvm1; Path=/webtools Set-Cookie: OFBiz.Visitor=10305; Expires=Tue, 28-Dec-2010 20:15:22 GMT; Path=/ Content-Type: text/xml;charset=utf-8 Vary: Accept-Encoding Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked 1e6 <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><Response><map-Map> <map-Entry> <map-Key> <std-String value="errorMessage"></std-String> </map-Key> <map-Value> <std-String value="Problem processing the service"></std-String> </map-Value> </map-Entry> </map-Map></Response></soapenv:Body></soapenv:Envelope> 24b <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><Response><map-Map> <map-Entry> <map-Key> <std-String value="errorMessage"></std-String> </map-Key> <map-Value> <std-String value="User authorization is required for this service: findPartiesById (User authorization is required for this service: findPartiesById)"></std-String> </map-Value> </map-Entry> </map-Map></Response></soapenv:Body></soapenv:Envelope> 0 {code} was (Author: snowch): I modified the SOAPEventHandler sendError method to set the content type to text/xml: {code} public class SOAPEventHandler implements EventHandler { ... private void sendError(HttpServletResponse res, String errorMessage) throws EventHandlerException { try { // setup the response res.setContentType("text/xml"); ... {code} This has resolved the content type error message, but I now get the following error message: {code} javax.xml.ws.WebServiceException: Unexpected response element Response expected: {http://ofbiz.apache.org/service/}findPartiesByIdResponse at com.sun.xml.internal.ws.client.sei.ResponseBuilder$RpcLit.readResponse(ResponseBuilder.java:603) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at $Proxy28.findPartiesById(Unknown Source) at javaapplication7.Main.main(Main.java:74) {code} It seems that the service is expecting the login.username and login.password parameters, but because of the namespace issue isn't detecting them from the request. Instead of returning the error in a <findPartiesByIdResponse> element, the service is returning the error in a generic <Response> element. {code} <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body> <Response> <map-Map> <map-Entry> <map-Key> <std-String value="errorMessage"></std-String> </map-Key> <map-Value> <std-String value="Problem processing the service"></std-String> </map-Value> </map-Entry> </map-Map> </Response> </soapenv:Body> </soapenv:Envelope> {code} > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chris snow updated OFBIZ-3385: ------------------------------ Attachment: patch.txt > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795470#action_12795470 ] chris snow commented on OFBIZ-3385: ----------------------------------- I'm also having problems trying to call findPartiesById using a C# 3.5 client. I am getting a valid SOAP response from the server from the client call (shown below the code), but the generated client code doesn't appear to be able to re-use the IN object for storing the OUT value. This is the same problem I had experience with the java code. Has anyone managed to generate a SOAP client against the ofbiz generated wsdl and successfully make a call? Can you spot where I am going wrong? Many thanks in advance, Chris ------------ C# code --------------- {code} using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using ConsoleApplication1.ServiceReference1; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { findPartiesByIdPortTypeClient client = new findPartiesByIdPortTypeClient(); mapEntry[] mapEntryArray = new mapEntry[3]; mapEntryArray[0] = makeMap("idToFind", "admin"); mapEntryArray[1] = makeMap("login.username", "admin"); mapEntryArray[2] = makeMap("login.password", "ofbiz"); client.findPartiesById(ref mapEntryArray); Console.WriteLine(mapEntryArray.Length); // is 0, but should be 3 Console.Read(); } static mapEntry makeMap(String keyString, String valString) { stdString mapKeyString = new stdString(); stdString mapValString = new stdString(); mapKeyString.value = keyString; mapValString.value = valString; mapKey key = new mapKey(); key.stdString = mapKeyString; mapValue val = new mapValue(); val.Item = mapValString; val.ItemElementName = ItemChoiceType.stdString; mapEntry entry = new mapEntry(); entry.mapKey = key; entry.mapValue = val; return entry; } } } {code} -------------- SOAP Response ---------------- {code} Date: Wed, 30 Dec 2009 12:00:38 GMT Set-Cookie: JSESSIONID=018C937189AF33CDD44D2C69862E5CE1.jvm1; Path=/webtools Set-Cookie: OFBiz.Visitor=11818; Expires=Thu, 30-Dec-2010 12:00:38 GMT; Path=/ Content-Type: text/xml;charset=utf-8 Vary: Accept-Encoding Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked 4e4 <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns7:findPartiesByIdResponse xmlns:axis2ns7="http://ofbiz.apache.org/service/"><map-Map> <map-Entry> <map-Key> <std-String value="responseMessage"></std-String> </map-Key> <map-Value> <std-String value="success"></std-String> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="party"></std-String> </map-Key> <map-Value> <eeval-Party createdStamp="2009-12-24 16:13:30.949" createdTxStamp="2009-12-24 16:13:30.946" lastUpdatedStamp="2009-12-24 16:13:31.892" lastUpdatedTxStamp="2009-12-24 16:13:31.553" partyId="admin" partyTypeId="PERSON"></eeval-Party> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="partiesFound"></std-String> </map-Key> <map-Value> <col-Collection></col-Collection> </map-Value> </map-Entry> </map-Map></axis2ns7:findPartiesByIdResponse></soapenv:Body></soapenv:Envelope> 0 {code} > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796544#action_12796544 ] chris snow commented on OFBIZ-3385: ----------------------------------- My colleague has also tried to connect usinf flex 3 (actionscript 3). He has experienced a similar problem that actionscript isn't able to de-serialize the response from the server. > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hans Bakker closed OFBIZ-3385. ------------------------------ Resolution: Fixed Thank you Chris, for the patch: Committed revision 895944. > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chris snow updated OFBIZ-3385: ------------------------------ Attachment: patch2.txt The original patch that I had uploaded for OFBIZ-3385 only solved some of the problems I was experiencing. patch2 fixes the other issues. With patch2, the netbeans generated code (jax-ws) now works. Unfortunately, the .NET code still doesn't work. > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt, patch2.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797024#action_12797024 ] Hans Bakker commented on OFBIZ-3385: ------------------------------------ Chris thank you for the patch2.txt file: Committed revision 896347. > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt, patch2.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux reopened OFBIZ-3385: ------------------------------------ Reopened at Chris's demand > Axis2 integration returns "Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]" > ------------------------------------------------------------------------------------------------------------ > > Key: OFBIZ-3385 > URL: https://issues.apache.org/jira/browse/OFBIZ-3385 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: chris snow > Attachments: patch.txt, patch2.txt > > > I have setup the findPartiesById service to export="true" and tried to call the web service using Netbeans 6.5. > I received the following error message: > {code} > com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml] > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) > at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) > at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) > at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) > at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) > at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) > at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) > at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) > at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) > at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) > at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) > at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) > at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) > at $Proxy28.findPartiesById(Unknown Source) > at javaapplication7.Main.main(Main.java:74) > {code} > Watching the tcp steam with wireshark, I can see that the prefix ns2 is added to the map-Entry items: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="idToFind"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.username"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="admin"/> > </ns2:map-Value> > </ns2:map-Entry> > <ns2:map-Entry> > <ns2:map-Key> > <ns2:std-String value="login.password"/> > </ns2:map-Key> > <ns2:map-Value> > <ns2:std-String value="ofbiz"/> > </ns2:map-Value> > </ns2:map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > If I copy this soap message and paste into SoapUI, the soap call fails. However, if I strip off the ns2 prefix from the map-Entry items (as below), the call succeeds: > {code} > <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Body> > <ns2:findPartiesById xmlns:ns2="http://ofbiz.apache.org/service/"> > <map-Map> > <map-Entry> > <map-Key> > <std-String value="idToFind"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.username"/> > </map-Key> > <map-Value> > <std-String value="admin"/> > </map-Value> > </map-Entry> > <map-Entry> > <map-Key> > <std-String value="login.password"/> > </map-Key> > <map-Value> > <std-String value="ofbiz"/> > </map-Value> > </map-Entry> > </map-Map> > </ns2:findPartiesById> > </S:Body> > </S:Envelope> > {code} > My java class is: > {code} > package javaapplication7; > import org.apache.ofbiz.service.MapEntry; > import org.apache.ofbiz.service.MapKey; > import org.apache.ofbiz.service.MapMap; > import org.apache.ofbiz.service.MapValue; > import org.apache.ofbiz.service.StdString; > public class Main { > public static void main(String[] args) { > try { > org.apache.ofbiz.service.FindPartiesById service = new org.apache.ofbiz.service.FindPartiesById(); > org.apache.ofbiz.service.FindPartiesByIdPortType port = service.getFindPartiesByIdPort(); > StdString keyString = new StdString(); > keyString.setValue("idToFind"); > MapKey mapKey = new MapKey(); > mapKey.setStdString(keyString); > > StdString valueString = new StdString(); > valueString.setValue("admin"); > > MapValue mapValue = new MapValue(); > mapValue.setStdString(valueString); > MapEntry mapEntry = new MapEntry(); > mapEntry.setMapKey(mapKey); > mapEntry.setMapValue(mapValue); > StdString keyStringLogin = new StdString(); > keyStringLogin.setValue("login.username"); > MapKey mapKeyLogin = new MapKey(); > mapKeyLogin.setStdString(keyStringLogin); > StdString valueStringLogin = new StdString(); > valueStringLogin.setValue("admin"); > MapValue mapValueLogin = new MapValue(); > mapValueLogin.setStdString(valueStringLogin); > MapEntry mapEntryLogin = new MapEntry(); > mapEntryLogin.setMapKey(mapKeyLogin); > mapEntryLogin.setMapValue(mapValueLogin); > StdString keyStringPassword = new StdString(); > keyStringPassword.setValue("login.password"); > MapKey mapKeyPassword = new MapKey(); > mapKeyPassword.setStdString(keyStringPassword); > StdString valueStringPassword = new StdString(); > valueStringPassword.setValue("ofbiz"); > MapValue mapValuePassword = new MapValue(); > mapValuePassword.setStdString(valueStringPassword); > MapEntry mapEntryPassword = new MapEntry(); > mapEntryPassword.setMapKey(mapKeyPassword); > mapEntryPassword.setMapValue(mapValuePassword); > MapMap myMap = new MapMap(); > myMap.getMapEntry().add(mapEntry); > myMap.getMapEntry().add(mapEntryLogin); > myMap.getMapEntry().add(mapEntryPassword); > javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap = > new javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap); > port.findPartiesById(mapMap); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
Free forum by Nabble | Edit this page |