Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How to write Perl Client that uses WCF TCP/IP Service

by Anonymous Monk
on Sep 02, 2011 at 23:46 UTC ( [id://923951]=note: print w/replies, xml ) Need Help??


in reply to How to write Perl Client that uses WCF TCP/IP Service

(WCF) Service using TCP/IP (NOT SOAP)

The wikipedia says WCF is as SOAP over HTTP, SOAP over TCP, and SOAP over Message Queues, etc so just use SOAP::Simple or SOAP::Lite or some such

  • Comment on Re: How to write Perl Client that uses WCF TCP/IP Service

Replies are listed 'Best First'.
Re^2: How to write Perl Client that uses WCF TCP/IP Service
by PerlApprentice (Initiate) on Sep 16, 2011 at 22:26 UTC
    Thank you for your reply. I have been trying to get SOAP::Lite to work with my WCF Windows Service and all my efforts have been unsuccessful. Could you please tell me what I am doing wrong? My APP.CONFIG file in C#/XML looks like this:
    <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="workorder_testEntities" connectionString="metadata=res: +//*/Database_Testing.csdl|res://*/Database_Testing.ssdl|res://*/Datab +ase_Testing.msl;provider=System.Data.SqlClient;provider connection st +ring=&quot;Data Source=MYSERVER-NAME,1433;Initial Catalog=MYDATABASE- +NAME;Persist Security Info=True;User ID=wo_dbo;Password=dbo2wo;Multip +leActiveResultSets=True&quot;" providerName="System.Data.EntityClient +" /> </connectionStrings> <appSettings> <add key="DB_conn" value="Data Source=MYSERVER-NAME,1433;Initial C +atalog=MYDATABASE-NAME;User ID=MYID;Password=MYPASSWORD;"/> </appSettings> <system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Warning, Activit +yTracing" propagateActivity="true"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="De +fault"> <filter type="" /> </add> <add name="ServiceModelTraceListener"> <filter type="" /> </add> </listeners> </source> <source name="System.ServiceModel.MessageLogging" switchValue="W +arning, ActivityTracing"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="De +fault"> <filter type="" /> </add> <add name="ServiceModelMessageLoggingListener"> <filter type="" /> </add> </listeners> </source> </sources> <sharedListeners> <add initializeData="c:\users\MYUSER\documents\tfs-code\app_trac +elog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Versi +on=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp +"> <filter type="" /> </add> <add initializeData="c:\users\MYUSER\documents\tfs-code\app_mess +ages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Versi +on=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions=" +Timestamp"> <filter type="" /> </add> </sharedListeners> <trace autoflush="true" /> </system.diagnostics> <system.serviceModel> <diagnostics wmiProviderEnabled="true"> <messageLogging logMalformedMessages="true" logMessagesAtTranspo +rtLevel="true" /> </diagnostics> <client> <endpoint address="http://MYSERVER-NAME:8732/Company.Department. +Project.WCFService.ProjectService/mex" binding="basicHttpBinding" bindingConfiguration="" contract="C +ompany.Department.Project.WCFService.IProjectService" name="Company.Department.Project.WCFService.ProjectService"> <identity> <certificateReference storeName="My" storeLocation="LocalMac +hine" x509FindType="FindBySubjectDistinguishedName" /> </identity> </endpoint> </client> <bindings> <basicHttpBinding> <binding name="NewBinding1" /> </basicHttpBinding> <netTcpBinding> <binding name="TCPBinding" closeTimeout="23:59:59" openTimeout +="23:59:59" receiveTimeout="23:59:59" sendTimeout="23:59:59" maxConnecti +ons="20"> <reliableSession inactivityTimeout="23:59:59" /> <security> </security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="Company.Department.Project.WCFService.ProjectS +erviceBehavior"> <serviceMetadata httpGetEnabled="True" /> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="Company.Department.Project.WCFSe +rvice.ProjectServiceBehavior" name="Company.Department.Project.WCFService.ProjectService"> <endpoint address="net.tcp://MYSERVER-NAME:8762/ProjectService +" binding="netTcpBinding" bindingConfiguration="TCPBinding" na +me="TCPEndpoint" contract="Company.Department.Project.WCFService.IProjectServ +ice"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://MYSERVER-NAME:8732/Company.Departmen +t.Project.WCFService.ProjectService/mex" binding="basicHttpBinding" bindingConfiguration="" name="Com +pany.Department.Project.WCFService.ProjectService" bindingName="basicHttpBinding" contract="IMetadataExchange" +/> <host> <baseAddresses> <add baseAddress="http://MYSERVER-NAME:8732/Company.Depart +ment.Project.WCFService.ProjectService/" /> </baseAddresses> <timeouts closeTimeout="23:59:59" openTimeout="23:59:59" /> </host> </service> </services> </system.serviceModel> <system.web> <compilation debug="true" /> </system.web> </configuration>
    And my C# Interface looks like this:
    using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; using Company.Department.Project.BusinessEntities; using Company.Department.ProjectB.BusinessLogic; using Company.Department.ProjectB.BusinessEntities; namespace Company.Department.Project.WCFService { [ServiceContract(Name = "Company.Department.Project.WCFService.Pro +jectService", Namespace = "http://projectservice.department.company.c +om/")] public interface IProjectService { [OperationContract(Name="GetWorkOrderList")] List<BEWorkOrder> GetWorkOrderList(string siteId); [OperationContract(Name="GetWorkOrder")] BEWorkOrder GetWorkOrder(string woName, string siteId); [OperationContract(Name="ReturnStatus")] string ReturnStatus(); } }
    And the PERL CODE I have looks like this:
    #!/usr/bin/perl -w use strict; use SOAP::Lite; my $url = 'http://MYSERVER-NAME:8732/Company.Department.Project.Projec +tService.ProjectService/?wsdl'; my $uri = 'http://tempuri.org/'; my $xmlns = 'http://tempuri.org/'; # Setup Network Connection my $soap = SOAP::Lite -> uri($uri) -> on_action(sub{sprintf '%sIProjectService/%s', @_}) -> proxy($url); my $response = $soap->GetWorkOrderList(SOAP::Data->new(name=>'siteId', + value=>'BKK')); if($response->fault){ die $response->faultstring; } else{ print $response->result; }
    The error that I get is "404 Not Found at PerlSOAPExample.pl line 17 which turns out to be "my $response = $soap->GetWorkOrderList(SOAP::Data->new(name=>'siteId', value=>'BKK'));" so it seems like the data is just not going through and being received in Perl. When I entered the URL in Chrome or IE (http://MYSERVER-NAME:8732/Company.Department.Project.ProjectService.ProjectService/?wsdl) I do get the XML page returned by the Server. What am I doing incorrectly for Perl not to be able to consume the WCF Service? Any ideas? Anyone who has successfully accomplished communication between WCF and Perl?
      Did you ever resolve this - I too am trying to get a console hosted WCF application to talk to a perl client. I can't believe it is not possible to either configure the service to be compatible with perl or to make the perl connect to the WCF service I have running. Surely it is all about interprocess and therefore cross platform communication?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found