Loading ...
Sorry, an error occurred while loading the content.

Re: [XMLRPCNET] Re: NullReferenceException

Expand Messages
  • Charles Cook
    Hi Roland: it s a reported issue: http://code.google.com/p/xmlrpcnet/issues/detail?id=37 The response contains a element which is non-standard XML-RPC
    Message 1 of 4 , Jan 9, 2009
    View Source
    • 0 Attachment
      Hi Roland: it's a reported issue:
      http://code.google.com/p/xmlrpcnet/issues/detail?id=37

      The response contains a <nil/> element which is non-standard XML-RPC and is
      not currently supported. The bug report suggests a way to modify the code to
      handle. I am planning to add support for <nil> in the next release.

      :Charles


      On Thu, Jan 8, 2009 at 9:56 PM, gruberroland64 <gruberroland64@...>wrote:

      > Hi Charles
      >
      > Thanks for your fast reply. Here is the xml response...
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <methodResponse><params><param><value><struct><member><name>category_i
      > d</name><value><string>1</string></value></member><member><name>parent
      > _id</name><value><string>0</string></value></member><member><name>name
      > </name><value><string>Root
      > Catalog</string></value></member><member><name>is_active</name><value>
      > <nil/></value></member><member><name>position</name><value><string>1</
      > string></value></member><member><name>level</name><value><string>0</st
      > ring></value></member><member><name>children</name><value><array><data
      > ><value><struct><member><name>category_id</name><value><string>2</stri
      > ng></value></member><member><name>parent_id</name><value><string>0</st
      > ring></value></member><member><name>name</name><value><string>Default
      > Category</string></value></member><member><name>is_active</name><value
      > ><string>1</string></value></member><member><name>position</name><valu
      > e><string>1</string></value></member><member><name>level</name><value>
      > <string>1</string></value></member><member><name>children</name><value
      > ><array><data/></array></value></member></struct></value></data></arra
      > y></value></member></struct></value></param></params></methodResponse>
      >
      > --- In XMLRPCNET@yahoogroups.com <XMLRPCNET%40yahoogroups.com>,
      > "charlescookuk" <chascook@...>
      > wrote:
      >
      > >
      > > Hi Roland: it would be useful to see what the response XML contains.
      > >
      > > :Charles
      > >
      > > --- In XMLRPCNET@yahoogroups.com <XMLRPCNET%40yahoogroups.com>,
      > "gruberroland64"
      > > <gruberroland64@> wrote:
      > > >
      > > > Hi
      > > >
      > > > I'm trying to get datas from a PHP-Webservice into an
      > xmlrpcstruct
      > > > and get all the time a nullreferenceexception. My code ist like
      > > > below...
      > > >
      > > > The interface code is...
      > > >
      > > > [XmlRpcUrl
      > > > ("http://www.yourdomain.com/shop/index.php/api/xmlrpc/")]
      > > > public interface IMagento : IXmlRpcProxy
      > > > {
      > > > [XmlRpcMethod("login")]
      > > > String login(String apiUser, String apiKey);
      > > >
      > > > [XmlRpcMethod("endSession")]
      > > > Boolean endSession(String sessionID);
      > > >
      > > > [XmlRpcMethod("call")]
      > > > XmlRpcStruct call(String sessionID, String resourcePath);
      > > >
      > > > }
      > > >
      > > > And the rest of the code...
      > > >
      > > > try
      > > > {
      > > > String apiuser = "user";
      > > > String apipasswort = "password";
      > > >
      > > > IMagento proxy = (IMagento)XmlRpcProxyGen.Create
      > > > (typeof(IMagento));
      > > >
      > > > string session = proxy.login(apiuser,
      > apipasswort);
      > > >
      > > > XmlRpcStruct mystruct = new XmlRpcStruct();
      > > >
      > > > if (mystruct != null)
      > > > {
      > > > if (proxy != null)
      > > > {
      > > > mystruct = proxy.call
      > > > (session, "category.tree");
      > > > }
      > > > }
      > > >
      > > > textBox1.Text += Environment.NewLine + session;
      > > >
      > > > if (mystruct != null)
      > > > {
      > > > foreach (DictionaryEntry d in mystruct)
      > > > {
      > > > textBox1.Text += d.Key + " " + d.Value +
      > > > Environment.NewLine;
      > > > }
      > > > }
      > > > }
      > > >
      > > > catch (XmlRpcFaultException fex)
      > > > {
      > > > textBox1.Text += Environment.NewLine +
      > fex.ToString();
      > > > }
      > > >
      > > > catch (Exception ex)
      > > > {
      > > > textBox1.Text += Environment.NewLine + ex.ToString
      > ();
      > > > }
      > > >
      > > > The error "System.NullReferenceException: Object reference not
      > set to
      > > > an instance of an object" reference to the line...
      > > > mystruct = proxy.call(session, "category.tree");
      > > >
      > > > And the exactly error message is:
      > > >
      > > > System.NullReferenceException: Der Objektverweis wurde nicht auf
      > eine
      > > > Objektinstanz festgelegt.
      > > > bei CookComputing.XmlRpc.XmlRpcStruct.Add(Object key, Object
      > value)
      > > > bei CookComputing.XmlRpc.XmlRpcSerializer.ParseHashtable
      > (XmlNode
      > > > node, Type valueType, ParseStack parseStack, MappingAction
      > > > mappingAction)
      > > > bei CookComputing.XmlRpc.XmlRpcSerializer.ParseValue(XmlNode
      > node,
      > > > Type ValueType, ParseStack parseStack, MappingAction
      > mappingAction,
      > > > Type& ParsedType, Type& ParsedArrayType)
      > > > bei CookComputing.XmlRpc.XmlRpcSerializer.ParseValue(XmlNode
      > node,
      > > > Type ValueType, ParseStack parseStack, MappingAction
      > mappingAction)
      > > > bei CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse
      > > > (XmlDocument xdoc, Type returnType)
      > > > bei CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse
      > > > (Stream stm, Type svcType)
      > > > bei CookComputing.XmlRpc.XmlRpcClientProtocol.ReadResponse
      > > > (XmlRpcRequest req, WebResponse webResp, Stream respStm, Type
      > > > returnType)
      > > > bei CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object
      > > > clientObj, MethodInfo mi, Object[] parameters)
      > > > bei CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke
      > (MethodInfo
      > > > mi, Object[] Parameters)
      > > > bei XmlRpcProxyb97e1af0-ada3-4512-a3f0-7f7dd5fea927.call
      > (String
      > > > sessionID, String resourcePath)
      > > > bei MagentoAPI.Form1.button1_Click(Object sender, EventArgs e)
      > in
      > > > C:\Form1.cs:Zeile 40.
      > > >
      > > > Can anybody help me how to solve this problem? I checked all the
      > > > variables on this line, but no one of them is null. I also
      > checked
      > > > the response with fiddler and I get an xml response from the api.
      > > >
      > > > Kind regards
      > > > Roland
      > > >
      > >
      >
      >
      >


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.