[ https://issues.apache.org/jira/browse/OFBIZ-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014567#comment-13014567 ] Mansour Al Akeel commented on OFBIZ-3385: ----------------------------------------- Hello Chris, sorry for the late reply. I was using axis2 with jaxbri binding. AFAIR the issue was the xml binding itself. Ofbiz web services uses map based results. And we need to tweak them. For example, you will see an element in the response like "eeval-". You need to edit the wsdl, and append the entity type. For example eeval-Party or eeval-Product. Then you need to modify the binding in the generated stub to match this. Here's what I did, I downloaded the wsdl I need to generate stubs for, modified it, then generated the stubs. After that I modified the xml binding, and the object type. I think it was done in the resulting MapValue class. And by the way, if you are using axis2, you may need to add ofbiz namespace to the generated response class. For example FindByIdResponse.java needs the namespace added. I am not sure about .NET, so I can't help here. Sorry. > 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. For more information on JIRA, see: http://www.atlassian.com/software/jira |
Free forum by Nabble | Edit this page |