Users - Calling a web service using perl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Users - Calling a web service using perl

drosowsk
Hi list!
I'm trying to call a web service using perl. But I always get a SAX
exception. It worked before, so I can't see why it shouldn't work now.

Here is the exception:

---- exception report
----------------------------------------------------------
Service [remoteCreateHaendler] threw an unexpected exception/error
Exception: org.ofbiz.service.GenericServiceException
Message: RPC error (; nested exception is:
        org.xml.sax.SAXParseException: Content is not allowed in prolog.)

Here is my service definition:

    <service name="remoteCreateHaendler" engine="soap" export="true"
            location="http://localhost:8080/webtools/control/SOAPService"
invoke="createHaendler" auth="true">
        <description>einen Haendler anlegen</description>
        <namespace>http://localhost:80/</namespace>
        <attribute name="partyName" type="String" mode="IN"
optional="false"/>
        <attribute name="strasse" type="String" mode="IN" optional="true"/>
        <attribute name="ort" type="String" mode="IN" optional="true"/>
        <attribute name="plz" type="String" mode="IN" optional="true"/>
        <attribute name="trackingCode" type="String" mode="IN"
optional="false"/>
        <attribute name="overrideLogo" type="String" mode="IN"
optional="true"/>
    </service>

And here is the perl code (I got it from the list too):

#!/usr/bin/perl

use SOAP::Lite +trace => [qw(transport debug)];
use warnings;
use Data::Dumper;

my $customer='xxxxx';
my $password='xxxxx';
my $partyName='myName';
my $trackingCode='code123';

my $s = SOAP::Lite
  -> uri('http://localhost:8080/')
  -> proxy('http://localhost:8080/webtools/control/SOAPService');

my $r = $s->remoteCreateHaendler(
        SOAP::Data->type('string')->name('login.username' => $customer),
        SOAP::Data->type('string')->name('login.password' => $password),
        SOAP::Data->type('string')->name('partyName' => $partyName),
        SOAP::Data->type('string')->name('trackingCode' => $trackingCode),
        );

Dumper $r;

What do I do wrong?
Any help is greatly appreciated!

Cheers,
Daniel

--
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Calling a web service using perl

Andrew Sykes
Daniel,

It seems you have some extra content in the XML doc that isn't allowed.
This could well be something to do with the difference between the way
the two languages handle the XML.

Unfortunately I can't really be any more specific that that.

I hope that helps (at least a bit).
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Users - CMS renderSubContentCache

Andrew Sykes
I'm having a problem with including an image using...
<@renderSubContentCache subContentId="AN_IMAGE" />

Sometimes the image appears, sometimes not, If I look up "AN_IMAGE" in
Content/DataResource. Suddenly the image will appear on the site. I
don't need to modify the DataResource record, simply view it.

I've tried both
<@renderSubContentCache
and
<@renderSubContent

It seems to make no difference.

Does anyone have any suggestions?
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Calling a web service using perl

drosowsk
In reply to this post by Andrew Sykes
> Daniel,

Hi Andrew,

> It seems you have some extra content in the XML doc that isn't allowed.
> This could well be something to do with the difference between the way
> the two languages handle the XML.

seems reasonable. At least that's how I would interpret the exception. What
makes me wonder is, that some time ago, I already successfully called a
service using perl. But I can't find a difference in handling it now.

> Unfortunately I can't really be any more specific that that.

That is unfortunately indeed :-)
Maybe someone else had similar issues.

> I hope that helps (at least a bit).

Yes, it does. If not solving the problem, but cutting it down.

Cheers,

Daniel

--
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Calling a web service using perl

Andrew Sykes
Daniel,

Perhaps you should try to dump the incoming SOAP request to a file?

You can probably do this around SOAPEventHandler.java

Sorry I can't be more help.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

byersa
In reply to this post by Andrew Sykes
Andrew,

I just got home after a personal trip where I did not have much time or
capacity for working on this. The whole content management stuff needs
to be converted over to widget tech and fixed in the process. I am going
to try to put a couple hours a night on this. I will keep you informed.

-Al

Andrew Sykes wrote:

>I'm having a problem with including an image using...
><@renderSubContentCache subContentId="AN_IMAGE" />
>
>Sometimes the image appears, sometimes not, If I look up "AN_IMAGE" in
>Content/DataResource. Suddenly the image will appear on the site. I
>don't need to modify the DataResource record, simply view it.
>
>I've tried both
><@renderSubContentCache
>and
><@renderSubContent
>
>It seems to make no difference.
>
>Does anyone have any suggestions?
>  
>

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

David E. Jones
In reply to this post by Andrew Sykes

Andrew,

Could you describe more of the error condition when the image does not appear? Is there anything in the log for the request? Also, is this a recent revision of OFBiz?

It sounds like there is a bug in it, and based on what you described perhaps related to loading it from the db which is why it comes from the cache fine when loaded from other code elsewhere... This means there is a less than ideal design here that has more than one code block to do this particular thing, and in one place it works and in another it doesn't.

-David


Andrew Sykes wrote:

> I'm having a problem with including an image using...
> <@renderSubContentCache subContentId="AN_IMAGE" />
>
> Sometimes the image appears, sometimes not, If I look up "AN_IMAGE" in
> Content/DataResource. Suddenly the image will appear on the site. I
> don't need to modify the DataResource record, simply view it.
>
> I've tried both
> <@renderSubContentCache
> and
> <@renderSubContent
>
> It seems to make no difference.
>
> Does anyone have any suggestions?
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

Andrew Sykes
David,

Here's some more detail.

The content is associated with the seed reader and defined like so...
    <DataResource dataResourceId="WELCOME"
dataResourceTypeId="OFBIZ_FILE_BIN" dataTemplateTypeId="NONE"
mimeTypeId="image/gif" objectInfo="/hot-
deploy/project/webapp/projectbranding/Welcome.gif" isPublic="Y"
createdDate="2006-03-10 16:44:02.138" createdByUserLogin="admin"/>
    <Content contentId="WELCOME" contentTypeId="DOCUMENT"
dataResourceId="WELCOME" contentName="Welcome" description="Welcome"
createdDate="2006-03-10 16:44:48.408" createdByUserLogin="admin"/>

I run "ant run-install-seed run"

I go to the frontpage. The page renders fine, but does not show
Welcome.gif. The HTML for Welcome.gif is there, but the image itself
does not show.
<img src="/content/control/img?imgId=WELCOME"/>

I said before that looking up the DataResource seemed to fix this, I
think it depends more on actually being logged in. If I log in, the
content appears, if I then logout, the content disappears again.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

Andrew Sykes
David,

One last thing.

Logging in as a customer doesn't work, but logging in as an admin
does...

Any thoughts?
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

David E. Jones

Andrew,

It sounds like this may be related to changes I did last week (on that digital download work) to protect DataResources. I just committed a change in rev 6995 so that if the isPublic flag is set to Y then no UserLogin is required, otherwise it is and the client must be associated with it (and that association constraint needs to be expanded still...). As long as the isPublic flag is set to Y then it should always work.

BTW, you can get more information my hitting the URL directly in the browser instead of just looking at the page that tries to include it as an image. If there is still an issue with this after updating you might want to try this.

-David


Andrew Sykes wrote:
> David,
>
> One last thing.
>
> Logging in as a customer doesn't work, but logging in as an admin
> does...
>
> Any thoughts?
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS renderSubContentCache

Andrew Sykes
David,

It looks like you've cracked it!

The image seems to be appearing consistently now.

Thanks.
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Calling a web service using perl

Scott Gray
In reply to this post by drosowsk
Hi Daniel

Did you manage to resolve this issue?  From my experience using web services
with ofbiz I only ever saw the message 'Content is not allowed in prolog'
when an exception was occurring on the ofbiz side of things.  Have you
checked the log for ofbiz? There may be a problem with your service

Regards
Scott

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Daniel Rosowski
Sent: Wednesday, 15 March 2006 11:41 p.m.
To: [hidden email]
Subject: [OFBiz] Users - Calling a web service using perl

Hi list!
I'm trying to call a web service using perl. But I always get a SAX
exception. It worked before, so I can't see why it shouldn't work now.

Here is the exception:

---- exception report
----------------------------------------------------------
Service [remoteCreateHaendler] threw an unexpected exception/error
Exception: org.ofbiz.service.GenericServiceException
Message: RPC error (; nested exception is:
        org.xml.sax.SAXParseException: Content is not allowed in prolog.)

Here is my service definition:

    <service name="remoteCreateHaendler" engine="soap" export="true"
            location="http://localhost:8080/webtools/control/SOAPService"
invoke="createHaendler" auth="true">
        <description>einen Haendler anlegen</description>
        <namespace>http://localhost:80/</namespace>
        <attribute name="partyName" type="String" mode="IN"
optional="false"/>
        <attribute name="strasse" type="String" mode="IN" optional="true"/>
        <attribute name="ort" type="String" mode="IN" optional="true"/>
        <attribute name="plz" type="String" mode="IN" optional="true"/>
        <attribute name="trackingCode" type="String" mode="IN"
optional="false"/>
        <attribute name="overrideLogo" type="String" mode="IN"
optional="true"/>
    </service>

And here is the perl code (I got it from the list too):

#!/usr/bin/perl

use SOAP::Lite +trace => [qw(transport debug)];
use warnings;
use Data::Dumper;

my $customer='xxxxx';
my $password='xxxxx';
my $partyName='myName';
my $trackingCode='code123';

my $s = SOAP::Lite
  -> uri('http://localhost:8080/')
  -> proxy('http://localhost:8080/webtools/control/SOAPService');

my $r = $s->remoteCreateHaendler(
        SOAP::Data->type('string')->name('login.username' => $customer),
        SOAP::Data->type('string')->name('login.password' => $password),
        SOAP::Data->type('string')->name('partyName' => $partyName),
        SOAP::Data->type('string')->name('trackingCode' => $trackingCode),
        );

Dumper $r;

What do I do wrong?
Any help is greatly appreciated!

Cheers,
Daniel

--
"Feel free" mit GMX FreeMail!
Monat f|r Monat 10 FreeSMS inklusive! http://www.gmx.net

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Calling a web service using perl

drosowsk
> Hi Daniel

Hey Scott,

first of all, sorry for the late answer. I'm pretty busy with my studies
at the moment, so my reaction on email is kind of laggy  ;-)

> Did you manage to resolve this issue?  From my experience using web services
> with ofbiz I only ever saw the message 'Content is not allowed in prolog'
> when an exception was occurring on the ofbiz side of things.  Have you
> checked the log for ofbiz? There may be a problem with your service

No, I was not able to resolve it. But I have to admit, we're working
with a rather old checkout of ofbiz. I hope to get the issue resolved by
moving the codebase to a current checkout.

Cheers,
Daniel
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users