[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] soap4r/1.5.0 with wsdl4r/0.0.3

NAKAMURA, Hiroshi

9/13/2003 2:52:00 PM

Hi, all,

soap4r/1.5.0 is out.
RAA: http://www.ruby-lang.org/en/raa-list.rhtml?n...
Release Note: http://rrr.jin.gr.jp/doc/soap4r/RELEA...

What is SOAP4R?
http://rrr.jin.gr.jp/doc/soap4r/RELEA...#whats

Changes

Thousands of lines are changed in this release (*.rb in current
SOAP4R distribution has 30kloc or over). But the biggest change
is coding convention, camelCase to non_camel_case. Though I tried
to keep compatibility between 1.5.0 and 1.4.8, but there's no way
to keep it at a few point. If you'll find your code which was
developed for 1.4.8 does not run under 1.5.0, feel free to ask me
to solve the problem.

* Dependency libraries;
* Add net/http support. Users can try sample SOAP clients without
installing http-access2. For actual usage, consider installing
http-access2 for speed and thread-safe SOAP client.
CAUTION: Building SOAP CGI server needs http-access2 to be installed.
* Soap4r standalone server requires webrick module to be installed
instead of GServer.rb and httpserver.rb.
* Supports iconv. To use utf-8, you need to install iconv(included
in ruby/1.8) or uconv.
* Suspend NQXML XML parser support.
* Remove REXML processor version check. No longer needed.
* Rewrite tests with test/unit.

* Features;
* Efforts to support messaging with document/literal and ASP.NET
interoperability.
* Add document/literal messaging interface to wsdlDriver.rb. See a
very brief example in sample/soapbox/wsdlDriver.rb though I still
didn't try to login to Jabber server.. Jabber folks?
* XML pretty printing.
* Better Ruby object mapping. Rewrote RubytypeFactory to support
more Ruby objects. Tests in
AMarshal(http://cvs.m17n.org/~akr...) much helped it.
Thanks very much to Tanaka Akira-san.
* SOAPMarshal accepts IO as an output device like Marshal#dump.
* SOAPElement: constructor signature change. Added extraattrs
attribute.
* XSDDateTimeImpl: to_time did not set usec.
* StreamHandler: add reset method to shutdown a connection to a site.

* Others;
* Simplify installer and remove uninstaller. Saving inventory file
in src dir could be the problem.
* Class/Module architecture relocation.
* Changing coding convention to fit with Ruby's. Added
lib/soap/compat.rb which defines compatibility definitions for
1.4.8. lib/soap/compat.rb warns when the library is loaded.
* Many warnings raised under 1.8, caused by illegal references like
XSD::XSDInt in typeMap.rb. Soap4r defined toplevel::XSDInt.
Define XSD* classes in XSD module and introduce it to toplevel.

Thanks to all of soap4r users for their support.

Regards,
// NaHi

9 Answers

NAKAMURA, Hiroshi

11/2/2003 4:09:00 PM

0

Hi, all,

Soap4r/1.5.1 is out.
RAA: http://www.ruby-lang.org/en/raa-list.rhtml?n...
Release Note: http://rrr.jin.gr.jp/doc/soap4r/RELEA...

What is SOAP4R?
http://rrr.jin.gr.jp/doc/soap4r/RELEA...#whats

# I read ruby-talk ML so I might missed some articles posted to
# comp.lang.ruby... Send me directly if you have some trouble
# with soap4r.

Changes

Important news: Soap4r library is included in ruby distribution after
ruby/1.8.1. You might not be need to install this package under
ruby/1.8. The files this package includes and are not included in
ruby/1.8 distribution are an application program (bin/wsdl2ruby) and
some test codes. Consider to get this package if,
* You need the WSDL to ruby (reads a WSDL file and generates stubs
and Ruby class definitions) application, or
* You want to use soap4r under ruby/1.6.

Features;
* Sample updates; Update Amazon Web Service WSDL (v2 -> v3), and update
RAA WSDL(0.0.1 -> 0.0.2).
* Supports ivars of basetype and extending modules marshalling with XML
attribute. Using XML attribute to support ruby object dependent
information, marshalled object keeps compatibility with SOAP spec.
It shows the power of XML, extensibility.
Now I think SOAP marshaller supports all kind of object graph which
is supported by Ruby's original marshaller.
* Better XML pretty printing.

puts SOAPMarshal.dump(Person.new("NaHi", 33))
=>
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSc...
xmlns:env="http://schemas.xmlsoap.org/soap/envel...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance...
<env:Body>
<Person xmlns:n1="http://www.ruby-lang.org/xmlns/ruby/type/cu...
xsi:type="n1:Person"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/...
<age xsi:type="xsd:int">33</age>
<name xsi:type="xsd:string">NaHi</name>
</Person>
</env:Body>
</env:Envelope>

Installation;
* The previous version soap4r/1.5.0 required http-access2 to be
installed to build CGI server, but no longer needed fot this
purpose now. You can use almost all features of soap4r without
http-access2, but for actual usage, consider installing
http-access2 for speed and thread-safe SOAP client.
* Under ruby/1.8, installer installs lib files to rubylibdir
(e.g. /usr/local/lib/ruby/1.8) instead of sitelibdir
(e.g. /usr/local/lib/ruby/site_ruby/1.8)

Bug fixes;
* Do not introduce XSD constants to toplevel.
* 'NO_PROXY'/'no_proxy' env var was not supported under net/http. Fixed.
* Remove some ruby/1.8 dependent codes. Should work fine under 1.6, too.
* XSD::XSDString did not check its value space under $KCODE = 'NONE'
env for example where iconv module is not installed.
* XSD::XSDFloat, XSD::XSDDouble: add +/- sign explicitly when
stringified and embedded into XML instance. Ruby's sprintf may
format -0.0 as "0.0" (no minus sign) depending on underlying C
sprintf implementation.

Thanks to all of soap4r users for their support.

Regards,
// NaHi

NAKAMURA, Hiroshi

5/22/2005 9:57:00 AM

0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, all,

'SOAP4R' is an implementation of
Simple Object Access Protocol (SOAP) 1.1 (W3C Note).
http://www.w3.or...

RAA: http://raa.ruby-lang.org/list.rhtml?n...
Release Note: http://dev.ctor.org/doc/soap4r/RELEA...

After 1 and a half year developing from soap4r/1.5.2, soap4r/1.5.4 is
out. Version 1.5.3 is the module which is included in ruby-1.8.2, and
not released independently.

Most significant feature of 1.5.4 is WSDL support. Document/literal
service support for .NET interoperability. Improved XML Schema support
such as extension, restriction, simpleType, complexType + simpleContent,
ref, length, import, include. And many bugs were fixed.

* Changes in 1.5.4 from 1.5.3:
http://dev.ctor.org/soap4r/wiki/C...

* Changes in 1.5.3 from 1.5.2:
http://dev.ctor.org/soap4r/wiki/Changes-ruby1...

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCkFdkf6b33ts2dPkRAgdjAJ42yce9O70TqY69q0lppf18RZl1LgCfa/CS
YMEcFeUXi5vqyBUDoOpZMiA=
=c213
-----END PGP SIGNATURE-----


Bob M

5/21/2007 8:28:00 PM

0

For your convenience I post example code as Console Application:
using System;

class ProgramConsole {

private const string StrGivenFn = "Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) -
(10 * x)";

public static double givenFn(double x) {

return (Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 * x));

// The expression following return statement is

// same as the constant StrGivenFn. How can StrGivenFn be used?

}

static void Main(string[] args) {

Console.WriteLine("f(x) = " + StrGivenFn);

Console.WriteLine("f(x) = " + givenFn(6) + " at x=6");

Console.ReadLine();

}

}







"Bob M" <bobM@NoSpam> wrote in message
news:u8HQZM%23mHHA.4848@TK2MSFTNGP05.phx.gbl...
> Hi Nicholas,
>
> Thanks. But I have to use that function (x^3 + 3x^2 - 10x) later in my
> application code. If I specify
> "Math.Pow(x, 3) + (3 * Math.Pow(x, > 2)) - (10 * x)" as string constant at
> one place, then how can I use this string constant in the return statement
> in the givenFn()method?
>
> My problem is a little bit different. Perhaps my code example did not
> elaborate the problem I am trying to convey. The revised code is posted
> again:
>
> <%@ Page Language="C#" %>
> <script runat="server">
>
> public static double givenFn(double x) {
>
> return (Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 * x)); // function
> expression
> }
>
> protected void Page_Load(object sender, EventArgs e) {
>
> Label1.Text = "f(x)=" + "Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 *
> x)";
> // Can this second string literal
> be retrieved
> // from the function expression in
> // givenFn() method to avoid
> typing (copy/paste
>
> Label2.Text = "f(x) = " + givenFn(6) + " at x=6";
> }
>
> </script>
> <html><body><form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
> <br />
> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
> </div>
> </form></body></html>
>
>
>


Jesse Houwing

5/21/2007 9:26:00 PM

0

* Bob M wrote, On 21-5-2007 22:27:
> For your convenience I post example code as Console Application:
> using System;
>
> class ProgramConsole {
>
> private const string StrGivenFn = "Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) -
> (10 * x)";
>
> public static double givenFn(double x) {
>
> return (Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 * x));
>
> // The expression following return statement is
>
> // same as the constant StrGivenFn. How can StrGivenFn be used?
>
> }
>
> static void Main(string[] args) {
>
> Console.WriteLine("f(x) = " + StrGivenFn);
>
> Console.WriteLine("f(x) = " + givenFn(6) + " at x=6");
>
> Console.ReadLine();
>
> }
>
> }

The answer is as you've feared all along, you cannot. At least not
without writing a full blown parser or finding a component that can
interpret your function. It's not in the base class library. Sorry.

Jesse

Bob M

5/21/2007 10:42:00 PM

0

Hi Jesse,

I am sorry to hear that "a string literal can not be converted to a C#
expression" (or vice versa).

But I have seen some websites where users can enter a mathematical
expression in a TextBox and gets some result after submitting. I do not
know how they do it. Maybe they use what you mention: full blown parser or
some component.

Bob_M



"Jesse Houwing" <jesse.houwing@nospam-sogeti.nl> wrote in message
news:uFwal8%23mHHA.3656@TK2MSFTNGP06.phx.gbl...

> The answer is as you've feared all along, you cannot. At least not without
> writing a full blown parser or finding a component that can interpret your
> function. It's not in the base class library. Sorry.
>
> Jesse


=?ISO-8859-1?Q?Arne_Vajh=F8j?=

5/22/2007 2:34:00 AM

0

Bob M wrote:
> For your convenience I post example code as Console Application:
> using System;
>
> class ProgramConsole {
>
> private const string StrGivenFn = "Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) -
> (10 * x)";
>
> public static double givenFn(double x) {
>
> return (Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 * x));
>
> // The expression following return statement is
>
> // same as the constant StrGivenFn. How can StrGivenFn be used?
>
> }
>
> static void Main(string[] args) {
>
> Console.WriteLine("f(x) = " + StrGivenFn);
>
> Console.WriteLine("f(x) = " + givenFn(6) + " at x=6");
>
> Console.ReadLine();
>
> }
>
> }

You want to evaluate a C# expression at runtime ?

You can call the compiler.

Below are some code to get you started.

Arne

==============================================================

using System;
using System.Collections.Generic;
using System.Reflection;
using System.CodeDom.Compiler;

using Microsoft.CSharp;

namespace E
{
public class DynComp
{
private static int n = 0;
private static Dictionary<string,object> m = new
Dictionary<string,object>();
public static double Eval(string expr, double x)
{
object o;
if(m.ContainsKey(expr))
{
o = m[expr];
}
else
{
n++;
string cn = "c" + n;
string src = "using System; public class " + cn + " { public static
double Eval(double x) { return " + expr + "; } }";
CodeDomProvider comp = new CSharpCodeProvider();
CompilerParameters param = new CompilerParameters();
param.GenerateInMemory = true;
param.ReferencedAssemblies.Add("System.dll");
CompilerResults res = comp.CompileAssemblyFromSource(param,
src);
Assembly asm = res.CompiledAssembly;
o = asm.CreateInstance(cn);
m.Add(expr, o);
}
return (double)o.GetType().InvokeMember("Eval",
BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static |
BindingFlags.InvokeMethod, null, null, new object[] { x });
}
}
public class MainClass
{
private const string StrGivenFn = "Math.Pow(x, 3) + (3 * Math.Pow(x,
2)) - (10 * x)";
public static double GivenFn(double x) {
return (Math.Pow(x, 3) + (3 * Math.Pow(x, 2)) - (10 * x));
}
public static void Main(string[] args)
{
Console.WriteLine(GivenFn(6));
Console.WriteLine(DynComp.Eval("Math.Pow(x, 3) + (3 * Math.Pow(x, 2))
- (10 * x)", 6));
Console.ReadLine();
}
}
}

Alun Harford

5/22/2007 4:13:00 AM

0

Arne Vajh?j wrote:
> You want to evaluate a C# expression at runtime ?
>
> You can call the compiler.
>
> Below are some code to get you started.

I'm not sure I'd want to put that on my webpage!
Talk about a security hole! :-)

Alun Harford

Marc Gravell

5/22/2007 6:59:00 AM

0

My though exactly... after all,
@"System.Diagnostics.Process.Start(""random.exe"").Id" is well-formed,
uses only "System" and returns a number ;-p
Even with partial trust I wouldn't want this *near* production code...
unless I really, really trust the input.

But if anyone has a parser...? I'm actually faced with a very similar
problem at the moment; I want to implement a filtered IBindingListView
(from scratch). This is very easy if I use a Predicate<T> - but if I
want to support the Filter property? Much harder... DataView uses
ExpressionParser, but this is internal and DataTable specific... does
anybody know of a viable implementation?

I'm thinking I'll live with a Predicate<T> for now ;-p It meets all my
needs... but it would be quite satisfying to finish the implementation
(since every other IBindingList / IBindingListView contract is met...)

Marc



=?ISO-8859-1?Q?Arne_Vajh=F8j?=

5/23/2007 12:05:00 AM

0

Alun Harford wrote:
> Arne Vajhøj wrote:
>> You want to evaluate a C# expression at runtime ?
>>
>> You can call the compiler.
>>
>> Below are some code to get you started.
>
> I'm not sure I'd want to put that on my webpage!
> Talk about a security hole! :-)

Good point.

But it is unavoidable if the requirement is to evaluate C#.

Requirements need to change.

Arne