[ 
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.

Reply via email to