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

Re: Building an xml-rpc server using XML-RPC.NET library

Expand Messages
  • synsuperior
    So, I guess a simplified question for this is: How do I write a XML-RPC server using XML-RPC.NET to consume the xml below? Any help or suggestion is
    Message 1 of 3 , Sep 30, 2010
    View Source
    • 0 Attachment
      So, I guess a simplified question for this is: How do I write a XML-RPC server using XML-RPC.NET to consume the xml below? Any help or suggestion is appreciated.
      One note: I am a newbie in XML-RPC, so please excuse me with any newbie question.
      Thanks again,

      P

      --- In XMLRPCNET@yahoogroups.com, "synsuperior" <synsuperior@...> wrote:
      >
      > Hi there,
      >
      > I'm building an xml-rpc server using XML-RPC.Net library with C# to receive calls from Shopatron server. Has anyone done this?
      >
      > Per Shopatron documentation, it says that Shopatron server will send my xml-rpc server a single xml package as a parameter. So, currently I have my xml-rpc server method implemented as followed.
      >
      > 1/ First Trial
      > [XmlRpcMethod("GetMyXml")]
      > public int GetMyXml(string xmlPackage)
      > {
      > //do stuffs
      > return 0;
      > }
      > This trial Shopatron server gets this error: XML-RPC Fault#-1: request contains struct value where string expected(as type String)[request:parameter 1]
      >
      > 2/ Second Trial
      > [XmlRpcMethod("GetMyXml")]
      > public int GetMyXml(SomeClass xmlPackage)
      > {
      > //do stuffs
      > return 0;
      > }
      > This trial Shopatron server gets this error: XML-RPC Fault#-1: request contains struct value with missing non-optional members: Variable1 Variable2[request:parameter 1: struct mapped to type SomeClass]
      >
      > 3/ Third Trial
      > [XmlRpcMethod("GetMyXml")]
      > public int GetMyXml(XmlRpcStruct xmlPackage)
      > {
      > //do stuffs
      > return 0;
      > }
      > This trial Shopatron server gets this error: XML-RPC Fault#-1: Index was outside the bounds of the array.
      >
      > So, my question is: what data type should the xmlPackage parameter has? Should it be some sort of a structure that is mapped to Shopatron xmlpackage? Could it be the SomeClass class has a wrong structure compare to the Shopatron xmlpackage.
      >
      > Here is a sample xml package from Shopatron taken out from their docs: I've never seen a real xml package yet, cause I can't get my xml-rpc server to work.
      >
      > <?xml version="1.0" encoding="ISO-8859-1" ?>
      > <methodCall>
      > <methodName>method_name_of_client_server</methodName>
      > <params>
      > <param>
      > <value>
      > <struct>
      > <member><name>ManufacturerID</name>
      > <value><int>138</int></value>
      > </member>
      > <member><name>CatalogID</name>
      > <value><int>0</int></value>
      > </member>
      > </struct>
      > </value>
      > </param>
      > <param>
      > <value>
      > <struct>
      > <member><name>OrderID</name>
      > <value><int>1528932</int></value>
      > </member>
      > <member><name>Address1</name>
      > <value><string>1026 Red Oak Drive</string></value>
      > </member>
      > <member><name>City</name>
      > <value><string>Cherry Hill</string></value>
      > </member>
      > <member><name>State</name>
      > <value><string>NJ</string></value>
      > </member>
      > <member><name>Zip</name>
      > <value><string>08003</string></value>
      > </member>
      > <member><name>Country</name>
      > <value><string>United States of America</string></value>
      > </member>
      > <member><name>CountryCode</name>
      > <value><string>US</string></value>
      > </member>
      > <member><name>currency_id</name>
      > <value><int>1</int></value>
      > </member>
      > <member><name>language_id</name>
      > <value><int>1</int></value>
      > </member>
      > <member><name>ShipType</name>
      > <value><string>sts</string></value>
      > </member>
      > <member><name>EstimatedShipping</name>
      > <value><double>8.9</double></value>
      > </member>
      > <member><name>EstimatedDistance</name>
      > <value><double>2491.38288904</double></value>
      > </member>
      > <member><name>MfgID</name>
      > <value><int>138</int></value>
      > </member>
      > <member><name>CatalogID</name>
      > <value><int>0</int></value>
      > </member>
      > <member><name>Discount</name>
      > <value>
      > <struct>
      > <member><name>DiscountDescription</name>
      > <value><string>Charity Giveback</string></value>
      > </member>
      > <member><name>DiscountPercentage</name>
      > <value><double>0.1</double></value>
      > </member>
      > <member>
      > <name>DiscountTotal</name>
      > <value><double>10.51</double></value>
      > </member>
      > </struct>
      > </value>
      > </member>
      > <member><name>CheckDate</name>
      > <value><int>156478887</int></value>
      > </member>
      > <member><name>OrderDate</name>
      > <value><int>156478887</int></value>
      > <member><name>OrderItems</name>
      > <value>
      > <struct>
      > <member><name>0</name>
      > <value>
      > <struct>
      > <member><name>ItemID</name>
      > <value><string>809479</string></value>
      > </member>
      > <member><name>ProdName</name>
      > <value><string>Sample Product</string></value>
      > </member>
      > <member><name>PartNumber</name>
      > <value><string>1002</string></value>
      > </member>
      > <member><name>UPC</name>
      > <value><string>6.51654654654655E+017</string></value>
      > </member>
      > <member>
      > <name>Options</name>
      > <value>
      > <struct>
      > <member><name>0</name><value><string>TextureRough</string></value></member>
      > <member><name>1</name><value><string>FrogOrange</string></value></member>
      > <member><name>2</name><value><string>StylesBird</string></value></member>
      > </struct>
      > </value>
      > </member>
      > <member><name>Quantity</name>
      > <value><int>1</int></value>
      > </member>
      > <member><name>CustPrice</name>
      > <value><double>5.65</double></value>
      > </member>
      > <member><name>PaymentDisc</name>
      > <value><double>0.1695</double></value>
      > </member>
      > <member><name>ShopatronDisc</name>
      > <value><double>0.26103</double></value>
      > </member>
      > <member><name>ManufacturerDisc</name>
      > <value><double>0.1695</double></value>
      > </member>
      > </struct>
      > </value>
      > </member>
      > </struct>
      > </value>
      > </member>
      > </member>
      > </struct>
      > </value>
      > </param>
      > </params>
      > </methodCall>
      >
      > I really thank you for your help.
      >
    • Jack
      Anyone around? I m still struggling with building an XML-RPC server using the XML-RPC.NET library to accept calls from PHP clients. Can anyone help? Thanks. P
      Message 2 of 3 , Oct 6, 2010
      View Source
      • 0 Attachment
        Anyone around? I'm still struggling with building an XML-RPC server using the XML-RPC.NET library to accept calls from PHP clients.
        Can anyone help?

        Thanks.
        P

        --- In XMLRPCNET@yahoogroups.com, "synsuperior" <synsuperior@...> wrote:
        >
        > So, I guess a simplified question for this is: How do I write a XML-RPC server using XML-RPC.NET to consume the xml below? Any help or suggestion is appreciated.
        > One note: I am a newbie in XML-RPC, so please excuse me with any newbie question.
        > Thanks again,
        >
        > P
        >
        > --- In XMLRPCNET@yahoogroups.com, "synsuperior" <synsuperior@> wrote:
        > >
        > > Hi there,
        > >
        > > I'm building an xml-rpc server using XML-RPC.Net library with C# to receive calls from Shopatron server. Has anyone done this?
        > >
        > > Per Shopatron documentation, it says that Shopatron server will send my xml-rpc server a single xml package as a parameter. So, currently I have my xml-rpc server method implemented as followed.
        > >
        > > 1/ First Trial
        > > [XmlRpcMethod("GetMyXml")]
        > > public int GetMyXml(string xmlPackage)
        > > {
        > > //do stuffs
        > > return 0;
        > > }
        > > This trial Shopatron server gets this error: XML-RPC Fault#-1: request contains struct value where string expected(as type String)[request:parameter 1]
        > >
        > > 2/ Second Trial
        > > [XmlRpcMethod("GetMyXml")]
        > > public int GetMyXml(SomeClass xmlPackage)
        > > {
        > > //do stuffs
        > > return 0;
        > > }
        > > This trial Shopatron server gets this error: XML-RPC Fault#-1: request contains struct value with missing non-optional members: Variable1 Variable2[request:parameter 1: struct mapped to type SomeClass]
        > >
        > > 3/ Third Trial
        > > [XmlRpcMethod("GetMyXml")]
        > > public int GetMyXml(XmlRpcStruct xmlPackage)
        > > {
        > > //do stuffs
        > > return 0;
        > > }
        > > This trial Shopatron server gets this error: XML-RPC Fault#-1: Index was outside the bounds of the array.
        > >
        > > So, my question is: what data type should the xmlPackage parameter has? Should it be some sort of a structure that is mapped to Shopatron xmlpackage? Could it be the SomeClass class has a wrong structure compare to the Shopatron xmlpackage.
        > >
        > > Here is a sample xml package from Shopatron taken out from their docs: I've never seen a real xml package yet, cause I can't get my xml-rpc server to work.
        > >
        > > <?xml version="1.0" encoding="ISO-8859-1" ?>
        > > <methodCall>
        > > <methodName>method_name_of_client_server</methodName>
        > > <params>
        > > <param>
        > > <value>
        > > <struct>
        > > <member><name>ManufacturerID</name>
        > > <value><int>138</int></value>
        > > </member>
        > > <member><name>CatalogID</name>
        > > <value><int>0</int></value>
        > > </member>
        > > </struct>
        > > </value>
        > > </param>
        > > <param>
        > > <value>
        > > <struct>
        > > <member><name>OrderID</name>
        > > <value><int>1528932</int></value>
        > > </member>
        > > <member><name>Address1</name>
        > > <value><string>1026 Red Oak Drive</string></value>
        > > </member>
        > > <member><name>City</name>
        > > <value><string>Cherry Hill</string></value>
        > > </member>
        > > <member><name>State</name>
        > > <value><string>NJ</string></value>
        > > </member>
        > > <member><name>Zip</name>
        > > <value><string>08003</string></value>
        > > </member>
        > > <member><name>Country</name>
        > > <value><string>United States of America</string></value>
        > > </member>
        > > <member><name>CountryCode</name>
        > > <value><string>US</string></value>
        > > </member>
        > > <member><name>currency_id</name>
        > > <value><int>1</int></value>
        > > </member>
        > > <member><name>language_id</name>
        > > <value><int>1</int></value>
        > > </member>
        > > <member><name>ShipType</name>
        > > <value><string>sts</string></value>
        > > </member>
        > > <member><name>EstimatedShipping</name>
        > > <value><double>8.9</double></value>
        > > </member>
        > > <member><name>EstimatedDistance</name>
        > > <value><double>2491.38288904</double></value>
        > > </member>
        > > <member><name>MfgID</name>
        > > <value><int>138</int></value>
        > > </member>
        > > <member><name>CatalogID</name>
        > > <value><int>0</int></value>
        > > </member>
        > > <member><name>Discount</name>
        > > <value>
        > > <struct>
        > > <member><name>DiscountDescription</name>
        > > <value><string>Charity Giveback</string></value>
        > > </member>
        > > <member><name>DiscountPercentage</name>
        > > <value><double>0.1</double></value>
        > > </member>
        > > <member>
        > > <name>DiscountTotal</name>
        > > <value><double>10.51</double></value>
        > > </member>
        > > </struct>
        > > </value>
        > > </member>
        > > <member><name>CheckDate</name>
        > > <value><int>156478887</int></value>
        > > </member>
        > > <member><name>OrderDate</name>
        > > <value><int>156478887</int></value>
        > > <member><name>OrderItems</name>
        > > <value>
        > > <struct>
        > > <member><name>0</name>
        > > <value>
        > > <struct>
        > > <member><name>ItemID</name>
        > > <value><string>809479</string></value>
        > > </member>
        > > <member><name>ProdName</name>
        > > <value><string>Sample Product</string></value>
        > > </member>
        > > <member><name>PartNumber</name>
        > > <value><string>1002</string></value>
        > > </member>
        > > <member><name>UPC</name>
        > > <value><string>6.51654654654655E+017</string></value>
        > > </member>
        > > <member>
        > > <name>Options</name>
        > > <value>
        > > <struct>
        > > <member><name>0</name><value><string>TextureRough</string></value></member>
        > > <member><name>1</name><value><string>FrogOrange</string></value></member>
        > > <member><name>2</name><value><string>StylesBird</string></value></member>
        > > </struct>
        > > </value>
        > > </member>
        > > <member><name>Quantity</name>
        > > <value><int>1</int></value>
        > > </member>
        > > <member><name>CustPrice</name>
        > > <value><double>5.65</double></value>
        > > </member>
        > > <member><name>PaymentDisc</name>
        > > <value><double>0.1695</double></value>
        > > </member>
        > > <member><name>ShopatronDisc</name>
        > > <value><double>0.26103</double></value>
        > > </member>
        > > <member><name>ManufacturerDisc</name>
        > > <value><double>0.1695</double></value>
        > > </member>
        > > </struct>
        > > </value>
        > > </member>
        > > </struct>
        > > </value>
        > > </member>
        > > </member>
        > > </struct>
        > > </value>
        > > </param>
        > > </params>
        > > </methodCall>
        > >
        > > I really thank you for your help.
        > >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.