Page 1 of 1

issue with AddContentBlock method (WS)

Posted: Thu Oct 01, 2015 4:16 pm
by burzum
Hello,

I am getting a "java.io.IOException: Server returned HTTP response code: 500 for URL" error when calling "AddContentBlock" method via the webservice into my java code.

When testing the webservice call with the same arguments on SoapUI, I get this error:
ExceptionMessage: Content with the same target id already exist

I am actually using targetID = 0, as shwon into examples.

My complete WS call request is :

Code: Select all

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://agnitas.org/ws/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:AddContentBlockRequest>
         <!--You may enter the following 5 items in any order-->
         <sch:mailingID>140</sch:mailingID>
         <sch:blockName>application</sch:blockName>
         <sch:targetID>0</sch:targetID>
         <sch:content>blablsdablda</sch:content>
         <sch:order>3</sch:order>
      </sch:AddContentBlockRequest>
   </soapenv:Body>
</soapenv:Envelope>
So far, I had been successfull to use all other openemm WS methods that I tried but this very one.

If I set targetID = 1, I get the same error.

If I set targetID = 2 or higher values, then I get : ExceptionMessage: Unknown target id (2).



Thx for your assistance.

Re: issue with addMailingFromTemplate method (WS)

Posted: Fri Oct 02, 2015 10:24 am
by mdoerschmidt
Hi!

It seems, you're mixing two different webservices in your post.

1. You are creating a new mailing using the webservice AddMailingFromTemplate.
2. New content blocks are added by AddContentBlock.

The error message "java.io.IOException: Server returned HTTP response code: 500 for URL" could be caused by some invalid invocation of AddMailingFromTemplate. Can you provide a SOAP request, that leads to that error? (The SOAP snipplet show an invocation of AddContentBlock)

The error message "ExceptionMessage: Content with the same target id already exist" is an error message, that is returned from AddContentBlock.
Having two content blocks with same name does not make sense if both blocks use same target group ID, too.
I guess, that your template has at least one content block. All content blocks defined in the template will be copied to new mailing when you call AddMailingFromTemplate. It seems, that you try to add a new content block that has same name and target group as a content block taken from the template.


Best regards

Re: issue with AddContentBlock method (WS)

Posted: Wed Oct 07, 2015 3:10 pm
by burzum
Hello,
thx for your answer.

Indeed, I did mix 2 methods names into my post. The one I am having trouble with is definitely AddContentBlock. I edited my original post accordingly.

So to summarize and clarify:
If I call AddContentBlock with the code from my original post using:
- targetID = 0 :
-> SoapUI returns " Content with the same target id already exist"
-> my Java code throws a "server returned HTTP response code : 500 for URL...
-> but the content is correctly added!
- targetID = 1 :
-> SoapUI returns " Content with the same target id already exist"
-> my Java code throws a "server returned HTTP response code : 500 for URL...
-> the content is NOT correctly added!
- targetID = 2 (or higher) :
-> SoapUI returns "Unknown target id (2)"
-> my Java code does not throw any exception
-> the content is NOT correctly added!

These results are quite confusing. When exceptions are triggered, it works. When no exceptions are triggered, content is not added.

Well I suppose I ll just ignore the exceptions and keep using the code that does add the content block. But if somebody can clarify the results that I listed, it will be interesting. :)

Thx.

Re: issue with AddContentBlock method (WS)

Posted: Thu Oct 08, 2015 3:53 pm
by burzum
Interesting enough, I have just found out that I also get a 500 error when calling updateMailingList() with the correct parameters.

If I call updateMailingList with correct values (AFAIK correct values at least...), I get in SoapUI:
HTTP/1.1 500 Server Error
Content-Length: 0
Server: Jetty(8.1.14.v20131031)

In Java I get :
javax.xml.ws.soap.SOAPFaultException: Could not send Message.

But the method is correctly executed.

On the other hand, if I set an invalid parameter, the method is not correctly executed and I get the appropriate ExceptionMessage in SoapUI : this part at least is normal.

Again, with other commands that I try, everything is correct (correct SoapUI messages and results). I ve just retested ListTemplatesRequest and a few other ones and it works like a charm on my end.