Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: PERL web service for use with MOSS2007 BDC

by Anonymous Monk
on Nov 30, 2009 at 15:49 UTC ( #810205=note: print w/replies, xml ) Need Help??

in reply to PERL web service for use with MOSS2007 BDC

Generally there are two things you should be aware of when having Perl interact with MOSS: 1. Suitable encoding of your SOAP parameters; 2. Provide WSDL for your webservice in the style of .NET-Webservices (suffixed ?wsdl-thing); and you should be fine. You could combine functionality of existing modules like SOAP::Lite and SOAP::WSDL. You can start e.g. with an instance of your own HTTP-Server (or proxy-class or simply use wireshark) to analyze the details of the web-requests made by the BDC to query your webservice. Hope this provides you some help.
  • Comment on Re: PERL web service for use with MOSS2007 BDC

Replies are listed 'Best First'.
Re^2: PERL web service for use with MOSS2007 BDC
by monkie (Novice) on Nov 30, 2009 at 21:21 UTC
    Thanks for your reply, I'm still having a the same issue and have provided some additional info. If anyone can point show me some wood between the trees, I'd be greatful.

    Here is the communication between the MS Application Definition Designer tool and my PERL web service:

    Sent by MS Application Definition Designer tool:
    POST /cgi-bin/tester.cgi HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client +Protocol 2.0.50727.1433) Content-Type: text/xml; charset=utf-8 SOAPAction: "" Host: Content-Length: 553 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="" +xmlns:soapenc="" xmlns:tns=" +" xmlns:types="http://services." xmlns:xsi=" +1/XMLSchema-instance" xmlns:xsd=""> <soap:Body soap:encodingStyle=" +oding/"> <tns:testing> <tester xsi:type="xsd:string">foo</tester> </tns:testing> </soap:Body> </soap:Envelope>

    Returned by my PERL web service
    HTTP/1.1 200 OK Date: Mon, 30 Nov 2009 18:06:00 GMT Server: Apache/2.2.4 (Debian) DAV/2 SVN/1.4.4 PHP/5.2.3-1+b1 mod_ssl/2 +.2.4 OpenSSL/0.9.8e mod_perl/2.0.3 Perl/v5.8.8 SOAPServer: SOAP::Lite/Perl/0.60 Content-Length: 551 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/xml; charset=utf-8 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi=" +e" xmlns:SOAP-ENC="" xmlns:S +OAP-ENV="" xmlns:xsd="http:/ +/" SOAP-ENV:encodingStyle="http://schemas.xm"> <SOAP-ENV:Body> <namesp1:testingResponse xmlns:namesp1=" +com/Services"> <Returned xsi:type="xsd:string">Back at ya</Returned> </namesp1:testingResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

    here is my wsdl file:
    <?xml version="1.0" encoding="UTF-8" ?> - <!-- WSDL for created by Pod::WSDL ve +rsion: 0.05 on Mon Nov 30 16:44:41 2009 --> - <wsdl:definitions targetNamespace=" +vices" xmlns:impl="" xmlns:wsdl +soap="" xmlns:wsdl="http://schem" xmlns:soapenc=" +encoding/" xmlns:xsd="" xmlns:tns1="h +ttp://"> - <wsdl:message name="testingRequest"> - <wsdl:part name="tester" type="xsd:string"> <wsdl:documentation>abc</wsdl:documentation> </wsdl:part> </wsdl:message> - <wsdl:message name="testingResponse"> - <wsdl:part name="testingReturn" type="xsd:string"> <wsdl:documentation>xyz</wsdl:documentation> </wsdl:part> </wsdl:message> - <wsdl:portType name="ServicesHandler"> - <wsdl:operation name="testing" parameterOrder="tester"> <wsdl:input message="impl:testingRequest" name="testingRequest" /> <wsdl:output message="impl:testingResponse" name="testingResponse" / +> </wsdl:operation> </wsdl:portType> - <wsdl:binding name="ServicesSoapBinding" type="impl:ServicesHandler" +> <wsdlsoap:binding style="rpc" transport=" +soap/http" /> - <wsdl:operation name="testing"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="testingRequest"> <wsdlsoap:body encodingStyle=" +ng/" namespace="" use="encoded" + /> </wsdl:input> - <wsdl:output name="testingResponse"> <wsdlsoap:body encodingStyle=" +ng/" namespace="" use="encoded" + /> </wsdl:output> </wsdl:operation> </wsdl:binding> - <wsdl:service name="ServicesHandlerService"> - <wsdl:port binding="impl:ServicesSoapBinding" name="Services"> <wsdlsoap:address location="" /> </wsdl:port> </wsdl:service> </wsdl:definitions>

    and my web service:
    #!/usr/bin/perl use strict; use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI -> dispatch_to('Services') -> handle; package Services; use strict; use DBI; use utf8; use Data::Dumper; my $STATUS = "FAILED"; my $MESSAGE = "FAILED"; sub testing() { my ($class, $message) = @_; my $log_file = "/tmp/tester.log"; open (LOG, ">>$log_file") or die("Open failed for $log_file : $!") +; print LOG "testing() #01 message=$message\n"; close(LOG); return SOAP::Data->name("Returned" => "Back at ya"); }

    and my ADF xml file:
    <?xml version="1.0" encoding="utf-8" standalone="yes" ?> - <LobSystem xmlns:xsi="" xsi +:schemaLocation=" +DataCatalog BDCMetadata.xsd" Type="WebService" Version="" Name +="WebServiceLobSystem" xmlns=" +6/03/BusinessDataCatalog"> - <Properties> <Property Name="WsdlFetchUrl" Type="System.String">http://services.c</Property> <Property Name="WebServiceProxyNamespace" Type="System.String">BDC</ +Property> </Properties> - <LobSystemInstances> - <LobSystemInstance Name="WebServiceLobSystem_Instance"> - <Properties> <Property Name="LobSystemName" Type="System.String">WebServiceLobSys +tem</Property> <Property Name="WebServiceAuthenticationMode" Type="Microsoft.Office +.Server.ApplicationRegistry.SystemSpecific.WebService.HttpAuthenticat +ionMode">PassThrough</Property> </Properties> </LobSystemInstance> </LobSystemInstances> - <Entities> - <Entity EstimatedInstanceCount="10000" Name="Entity11"> - <Identifiers> <Identifier TypeName="System.String" Name="testerID" /> </Identifiers> - <Methods> - <Method Name="testing"> - <Parameters> - <Parameter Direction="In" Name="tester"> <TypeDescriptor TypeName="System.String, mscorlib, Version=, +Culture=neutral, PublicKeyToken=b77a5c561934e089" IdentifierName="tes +terID" Name="tester" /> </Parameter> - <Parameter Direction="Return" Name="Return"> <TypeDescriptor TypeName="System.String, mscorlib, Version=, +Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Return" /> </Parameter> </Parameters> - <MethodInstances> <MethodInstance Type="SpecificFinder" ReturnParameterName="Return" R +eturnTypeDescriptorName="Return" ReturnTypeDescriptorLevel="0" Name=" +SpecificFinderTesterInstance" /> <MethodInstance Type="Finder" ReturnParameterName="Return" ReturnTyp +eDescriptorName="Return" ReturnTypeDescriptorLevel="0" Name="FinderTe +sterInstance" /> </MethodInstances> </Method> </Methods> </Entity> </Entities> </LobSystem>

    When executing my 'Specific Finder' method instance from within the MS ADD tool, I receive the error, "Index was out of range, Must be non-negitive and less than the size of the collection". The string parameter which I pass is written to the log file ("/tmp/tester.log") so at least I know communication is happening one way. When executing my 'Specific Finder' method instance from within the MS ADD tool, I receive the error, "Backend system adapter returned a structure incompatible with the corresponding metadata (MethodInstance, Parameter or TypeDescriptor)". The log file ("/tmp/tester.log") is also written to so I know that my script is being executed.

    As far as I can deduce, the MS ADD tool (and the BDC) are not being fed what they want - any ideas please?
Re^2: PERL web service for use with MOSS2007 BDC
by Anonymous Monk on Dec 03, 2009 at 11:57 UTC
    OK. Your service gets called by the BDC and obviously it can´t cope with the response data. There are several reasons. 1. ServiceDescription: Have a look at the WSDL that is returned by a typical .NET-WebService / Sharepoint WebServices and study the way, methods and parameters are described in there. Then try to roll a WSDL-file on your own that complies to that way. We had no success with Pod::*-built service descriptions either. 2. NamespaceConfusion: Neither the wsdl-file nor the adf-file contain the namespace used for the response data by the target (your service). Try to harmonize and again - have a look at a plain .NET-WebService example (or generate a simple one with VS and compare). 3. MS products usually expect web services to return a collection as response (wrapped in a SOAP-Envelope). This collection has to comply to the XML-DOM specification and contains exactly one root-element (e.g. testingResponse) that embraces a single or multiple child nodes that contain the response data you primarily want to deliver. To easily view that specific calling conventions yourself, simply navigate your browser to the URL of your example .asmx or one of the MOSS builtin webservices and it will display examples for various SOAP requests and responses. You get at the correspondig WSDL by suffixing the webservice´s URL with "?wsdl". The worst part is to emulate that (somewhat twisted) behaviour. Sometimes it´s more convenient to write a litte CGI-application / or a small http-server that processes BDC-requests and responds in the way .NET webservice consumers are used to than trying to adapt the behaviour of the SOAP-WSDL-related modules. These modules are excellent but unfortunately MS has chosen to implement a slightly deviant standard (although it´s still SOAP). Detailed descriptions of this deviance is spread throughout the web and you can find additional precious hints in this monastery. I´m sure you will get it to work soon.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://810205]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (1)
As of 2017-08-18 05:58 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (294 votes). Check out past polls.