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

Hello everybody,
I am a simple Perl user (not programmer ;) ) and need some help. My script is sending soap requests (using SOAP::Lite) to some thirdparty system. Everything worked just fine, until recently, when the system was upgraded and now is more strict, i guess, concering incoming requests. The same soap request sent via SOAP UI is processed just fine, but mine returns soap error "[Ljava.lang.String; cannot be cast to java.lang.String".
After consulting google and some trial/error, I surmise that the issue is somewhere in the transport parameters, so I would like to change them to be more like those used by SOAP UI (where possible), but I have no clue how :/. Could you please help?

I have attached below what wireshark logged.

Sent by my perl script:
POST /OELAdapterWebService HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close Accept: text/xml Accept: multipart/* Accept: application/soap Host: 172.26.9.9:8120 User-Agent: SOAP::Lite/Perl/1.06 Content-Length: 2728 Content-Type: text/xml SOAPAction: "/OELAdapter/ProcessDefinitions/Production/Services/OELAda +pter/SoapOverHttp/OELAdapter.serviceagent//ProcessOrderAsync" <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:oel="http://xxx.com/OELAdapter" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> ... </soapenv:Body> </soapenv:Envelope> HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Content-Length: 376 Date: Fri, 02 Jun 2017 08:40:20 GMT Connection: close <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode xmlns="">SO +AP-ENV:Server.InternalServerError</faultcode> <faultstring xmlns=""> +[Ljava.lang.String; cannot be cast to java.lang.String</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Sent from SOAP UI:
POST /OELAdapterWebService HTTP/1.1 Connection: close Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "/OELAdapter/ProcessDefinitions/Production/Services/OELAda +pter/SoapOverHttp/OELAdapter.serviceagent//ProcessOrderAsync" Content-Length: 3088 Host: 172.26.9.9:8120 User-Agent: Apache-HttpClient/4.1.1 (java 1.5) <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:oel="http://xxx.com/OELAdapter" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> ... </soapenv:Body> </soapenv:Envelope> HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Content-Length: 376 Date: Fri, 02 Jun 2017 08:58:39 GMT Connection: close

Replies are listed 'Best First'.
Re: SOAP::Lite headers
by poj (Abbot) on Jun 02, 2017 at 19:27 UTC

    Since the error relates to casting a list into a string and you have these 3 lines

    Accept: text/xml
    Accept: multipart/*
    Accept: application/soap
    

    the problem might be related to this bug report Issue with HTTP.pm

    Try adding this line

    $client->transport->http_request->header( Accept => 'text/xml, multipart/*, application/soap');
    poj
      You nailed it! I have not yet managed to fix it in my script, but changing it directly in the HTTP.pm helped.
      Thank you!
Re: SOAP::Lite headers
by thanos1983 (Parson) on Jun 02, 2017 at 15:28 UTC

    Hello eukiph,

    Welcome to the monastery. We need to see your script and ideally the version of the module SOAP::Lite in case there is a bug on old versions.

    Since you do not know much regarding Perl, hmmm do you know how the nodule was installed? Through CPAN?

    If so just apply:

    cpan -D SOAP::Lite CPAN: Storable loaded ok (v2.20) Reading '/root/.cpan/Metadata' Database was generated on Fri, 02 Jun 2017 13:54:43 GMT SOAP::Lite ---------------------------------------------------------------------- +--- CPAN: Module::CoreList loaded ok (v5.20170420) (no description) P/PH/PHRED/SOAP-Lite-1.20.tar.gz /usr/local/share/perl5/SOAP/Lite.pm Installed: 1.20 CPAN: 1.20 up to date Fred Moyer (PHRED) fred@redhotpenguin.com

    Hope this helps.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Hello Thanos,
      My script has been working for quite a while, co the version of SOAP::Lite it uses is 1.06 ...well, good point, i shall try a newer version and let you know whether the problem persists or not ;). (and copy/paste the script, if not)
      Eukiph

        Hello again,

        To update the module through CPAN is just cpan <module name>. It doesn't mean that this will solve your problem. There is a possibility that SOAP has been updated and requires a few new parameters and the current module that you are running has not been updated and not going to be. I. This case you need to search for a new more fresh module.

        Hope this helps to guide you to the correct direction.

        Seeking for Perl wisdom...on the process of learning...not there...yet!
Re: SOAP::Lite headers
by Anonymous Monk on Jun 02, 2017 at 18:53 UTC