Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: PERL web service for use with MOSS2007 BDC

by Anonymous Monk
on Nov 30, 2009 at 15:49 UTC ( [id://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.

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: services.camdev.cw.com Content-Length: 553 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns=" +http://services.camdev.cw.com/Services" xmlns:types="http://services. +camdev.cw.com/Services/encodedTypes" xmlns:xsi="http://www.w3.org/200 +1/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +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="http://www.w3.org/2001/XMLSchema-instanc +e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S +OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xm +lsoap.org/soap/encoding/"> <SOAP-ENV:Body> <namesp1:testingResponse xmlns:namesp1="http://services.camdev.cw. +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 http://services.camdev.cw.com created by Pod::WSDL ve +rsion: 0.05 on Mon Nov 30 16:44:41 2009 --> - <wsdl:definitions targetNamespace="http://services.camdev.cw.com/Ser +vices" xmlns:impl="http://services.camdev.cw.com/Services" xmlns:wsdl +soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schem +as.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/ +encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="h +ttp://services.camdev.cw.com/Services"> - <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="http://schemas.xmlsoap.org/ +soap/http" /> - <wsdl:operation name="testing"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="testingRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encodi +ng/" namespace="http://services.camdev.cw.com/Services" use="encoded" + /> </wsdl:input> - <wsdl:output name="testingResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encodi +ng/" namespace="http://services.camdev.cw.com/Services" use="encoded" + /> </wsdl:output> </wsdl:operation> </wsdl:binding> - <wsdl:service name="ServicesHandlerService"> - <wsdl:port binding="impl:ServicesSoapBinding" name="Services"> <wsdlsoap:address location="http://services.camdev.cw.com" /> </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="http://www.w3.org/2001/XMLSchema-instance" xsi +:schemaLocation="http://schemas.microsoft.com/office/2006/03/Business +DataCatalog BDCMetadata.xsd" Type="WebService" Version="1.0.0.0" Name +="WebServiceLobSystem" xmlns="http://schemas.microsoft.com/office/200 +6/03/BusinessDataCatalog"> - <Properties> <Property Name="WsdlFetchUrl" Type="System.String">http://services.c +amdev.cw.com/cgi-bin/tester.wsdl</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=2.0.0.0, +Culture=neutral, PublicKeyToken=b77a5c561934e089" IdentifierName="tes +terID" Name="tester" /> </Parameter> - <Parameter Direction="Return" Name="Return"> <TypeDescriptor TypeName="System.String, mscorlib, Version=2.0.0.0, +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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-28 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found