Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

.PerlNet .asmx

by rvlahov (Novice)
on Dec 10, 2002 at 02:57 UTC ( [id://218726]=perlquestion: print w/replies, xml ) Need Help??

rvlahov has asked for the wisdom of the Perl Monks concerning the following question:

All,

Absolutely new to .NET

I want to be able to call a perl module from a WebService. I compile test.pl and am trying to call it from
StringServer2.asmx. When I uncomment the 2 lines I feel should make it work
I get the following error:
C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Temporary ASP.NET Files\soaptest\5dee38ee\d9f5ec47\qyvdu9h0.cs(6,7): error CS0246: The type or namespace name 'OrangeSoap' could not be found (are you missing a using directive or an assembly reference?)
Stopped with exit code 1

What am I doing wrong.


-------------------------------------------------------
test.pm
gets compiles as "c:\> plc test.pm -target="library"
-------------------------------------------------------
package OrangeSoap::Test; =for interface [interface: pure] =cut =for interface str addthis(str thisstring); =cut sub addthis { my ($this, $thisstring);<br> return '***' . $thisstring . '***';<br> }
--------------------------------------------------------
StringServer2.asmx
located in c:\> inetpub\wwwroot\StringServer
When I uncomment 1 or both of the following 2 lines I get
an error
#use namespace "OrangeSoap.Test";
#my $s1 = thisstring;
--------------------------------------------------------
<%@ WebService class="StringServer3" Language="perl" %> package StringServer3; #use namespace "OrangeSoap.Test"; =for interface [System.Web.Services.WebMethod] str Concat(str str1, str str2); [System.Web.Services.WebMethod] str Concat2(str str1, str str2); =cut sub Concat{ my ($this, $str1, $str2) = @_; #my $s1 = thisstring; return($str1 . $str2 . $s1); } sub Concat2{ my ($this, $str1, $str2) = @_; return($str1 . $str2 . 'method 2'); }
------------------------------------------------------------
What am I doing wrong?
Thanks, Richard Vlahov

Replies are listed 'Best First'.
Re: .PerlNet .asmx
by dingus (Friar) on Dec 10, 2002 at 08:37 UTC
    You asked
    Absolutely new to .NET
    ...
    What am I doing wrong?

    Sarcastic answer
    Using .Net

    Less sarcastic answer
    Obvious things to check like your OrangeSoap is findable on the path etc etc. Also if you look at the perlmod manual you need to have a 1; as the last line of the package in your code shown above you don't.

    Dingus


    Enter any 47-digit prime number to continue.
Re: .PerlNet .asmx
by tachyon (Chancellor) on Dec 10, 2002 at 15:36 UTC

    You problems are syntax errors. I don't know what the rationale for using namespace.pm is as you have already created a namespace with your package declaration. The docs on namespace are here I presume that what you are trying to do is utilise the package Orange::Soap and its functions in StringServer2.asmx. For a detailed guide on the whyforehowdoyodoits see my Simple Module Turorial which should help you get the syntax sorted.

    #my $s1 = thisstring;

    This code is trying to assign the return value of the sub routine thisstring() to $s1 which is probably not what you had in mind. In perl a bareword is assumed to be a sub (function) call. These things will help you:

    use strict; use warnings; use diagnostics; # makes warnings verbose ++

    See Use strict warnings and diagnostics or die

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://218726]
Approved by mjeaton
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2025-07-12 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.