Highlighted
BacoJim Absent Member.
Absent Member.
1165 views

GW8 Message always null

gwsp2 is the name of my web reference:


gwsp2.Folder f = getMailbox();
itemsReq = new gwsp2.getItemsRequest();
itemReq = new gwsp2.getItemRequest();
itemsReq.container = f.fldId;
itemsResp = ws.getItemsRequest(itemsReq);


foreach (gwsp2.Item i in itemsResp.items)
{
gwsp2.Mail m = (gwsp2.Mail)i;
if (!m.status.read)
{
string messageBody = "";
if (null != newMailItem.message && 0 != newMailItem.message.Length)
{
gwsp2.MessagePart part = (gwsp2.MessagePart)newMailItem.message.GetValue(0);
System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding();
messageBody = utf8.GetString(part.Value);
}
}
}


private gwsp2.Folder getMailbox()
{
folderListReq = new gwsp2.getFolderListRequest();

folderListReq.recurse = true;
folderListReq.parent = "folders";
folderListResp = ws.getFolderListRequest(folderListReq);

if (0 == folderListResp.status.code)
{
if (null != folderListResp.folders)
{
foreach (gwsp2.Folder f in folderListResp.folders)
{
if (f.name == "Mailbox")
{
return f;
}
}
}
}
return null;
}



When I iterate through mailbox items I get a reference to the new mail item but newMailItem.message is always null. I can log in through the Novell WebAccess and see the message does in fact have a message body.

What am I doing wrong?
Labels (1)
Tags (3)
0 Likes
6 Replies
BacoJim Absent Member.
Absent Member.

Re: GW8 Message always null

I also tried the HTTP GET method described here:

How to get plain text rather than rich text


The response is coming back "bad request".

The url I am using is:

ourgwserver:8080/attachment?session=GazEYtI_vHV0izv8&id4E6F3001.test_dom.test_po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&plain=true


I would prefer to get the message body this way if possible.

Thanks in advance,
Jim
0 Likes
BacoJim Absent Member.
Absent Member.

Re: GW8 Message always null

Tried this as well:

gwsp2.getAttachmentRequest attachReq = new gwsp2.getAttachmentRequest();
gwsp2.getAttachmentResponse attachRes;

attachReq.id = newMailItem.id;
attachReq.offset = 0;
attachReq.length = -1;

attachRes = ws.getAttachmentRequestMessage(attachReq);

attachRes.part is null

help?
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: GW8 Message always null

When you ask for items, you need to explicitly ask for attachments
(the message body is an attachment). You could put "default message"
in the view when you get the items. You could include the soap trace
if you still have a problem.

You could include a wireshark track of the below. If that is indeed
what you supplied, a could of questions.
Is your SOAP port really 8080?
It should be "id=4E...". It looks like the '=' is missing.

Preston

>>> On Wednesday, September 21, 2011 at 9:16 AM,

BacoJim<BacoJim@no-mx.forums.novell.com> wrote:

> I also tried the HTTP GET method described here:
>
> 'How to get plain text rather than rich text'
>

(http://forums.novell.com/%20novell/product‑neutral/developers/dev‑group
wise‑we
>

b‑service‑soap/print‑415568‑how‑get‑plain‑text‑rather‑than
‑rich‑text.html)
>
>
> The response is coming back "bad request".
>
> The url I am using is:
>
>>

>

ourgwserver:8080/attachment?session=GazEYtI_vHV0izv8&id4E6F3001.test_dom.tes
t_
> po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&plain=true
>
> I would prefer to get the message body this way if possible.
>
> Thanks in advance,
> Jim

0 Likes
BacoJim Absent Member.
Absent Member.

Re: GW8 Message always null

Preston Stephenson;2139616 wrote:
..
You could include a wireshark track of the below. If that is indeed
what you supplied, a could of questions.
Is your SOAP port really 8080?
It should be "id=4E...". It looks like the '=' is missing.

Preston

>>> On Wednesday, September 21, 2011 at 9:16 AM,

BacoJim<BacoJim@no-mx.forums.novell.com> wrote:

> I also tried the HTTP GET method described here:
>
> 'How to get plain text rather than rich text'
>

(http://forums.novell.com/%20novell/product‑neutral/developers/dev‑group
wise‑we
>

b‑service‑soap/print‑415568‑how‑get‑plain‑text‑rather‑than
‑rich‑text.html)
>
>
> The response is coming back "bad request".
>
> The url I am using is:
>
>>

>

ourgwserver:8080/attachment?session=GazEYtI_vHV0izv8&id4E6F3001.test_dom.tes
t_
> po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&plain=true
>
> I would prefer to get the message body this way if possible.
>
> Thanks in advance,
> Jim

I'm not sure what a wireshark trace is. How do I get that?

No my port was not 8080, it is 7191.

I got the url working but only when I specify "mime=true". If I try "&plain=true" at the end it comes back with the 400 back request

http://testgwlx:7191/attachment?session=4cD8LxnWxIQtVMLp&id=4E6F3001.test_dom.test_po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&mime=true


I get the whole message (headers, mime content-type, plaintext and html code) back. Looks like my encoding is off though. I see a lot of "=" signs at the end of the lines. It's BASE64 encoded right? I think I can figure that out but an example would be great if you have one handy.

Is there a way to get back just the message body in plain text or am I going to have to parse the mime return?

Thanks in advance,
Jim
0 Likes
BacoJim Absent Member.
Absent Member.

Re: GW8 Message always null

Preston Stephenson;2139616 wrote:
When you ask for items, you need to explicitly ask for attachments
(the message body is an attachment). You could put "default message"
in the view when you get the items. You could include the soap trace
if you still have a problem.

Thank you! This works:

itemsReq.view = "default message";

Then read it with this:

string messageBody = "";

if (null != newMailItem.message && 0 != newMailItem.message.Length)
{
gwsp2.MessagePart part = (gwsp2.MessagePart)newMailItem.message.GetValue(0);
System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding();
messageBody = utf8.GetString(part.Value);
}

Much appreciate it. Thank you!
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: GW8 Message always null

Just a note:
You only use the HTTP GET method of getting the message body if
the message body is greater than 64KB.
If that is the case, only the id of the message body is returned
when you get the item (no message body data is returned).

Preston

>>> On Thursday, September 22, 2011 at 2:06 PM,

BacoJim<BacoJim@no-mx.forums.novell.com> wrote:

> Preston Stephenson;2139616 Wrote:
>> ..
>> You could include a wireshark track of the below. If that is indeed
>> what you supplied, a could of questions.
>> Is your SOAP port really 8080?
>> It should be "id=4E...". It looks like the '=' is missing.
>>
>> Preston
>>
>> >>> On Wednesday, September 21, 2011 at 9:16 AM,

>> BacoJim<BacoJim@no‑mx.forums.novell.com> wrote:
>>
>> > I also tried the HTTP GET method described here:
>> >
>> > 'How to get plain text rather than rich text'
>> >

>>

(http://forums.novell.com/%20novell/product‑neutral/developers/devââ
‚¬â€˜group
>> wise‑we
>> >

>>

b‑service‑soap/print‑415568‑how‑getâ€â
€˜plain‑text‑rather‑than
>> ‑rich‑text.html)
>> >
>> >
>> > The response is coming back "bad request".
>> >
>> > The url I am using is:
>> >
>> >>
>> >

>>

ourgwserver:8080/attachment?session=GazEYtI_vHV0izv8&id4E6F3001.test_dom.tes

>> t_
>> > po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&plain=true
>> >
>> > I would prefer to get the message body this way if possible.
>> >
>> > Thanks in advance,
>> > Jim

> I'm not sure what a wireshark trace is. How do I get that?
>
> No my port was not 8080, it is 7191.
>
> I got the url working but only when I specify "mime=true". If I try
> "&plain=true" at the end it comes back with the 400 back request
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>

http://testgwlx:7191/attachment?session=4cD8LxnWxIQtVMLp&id=4E6F3001.test_do
m
> .test_po.100.1767979.1.38.1@1:7.test_dom.test_po.100.0.1.0.1@16&mime=true
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> I get the whole message (headers, mime content‑type, plaintext and html
> code) back. Looks like my encoding is off though. I see a lot of "="
> signs at the end of the lines. It's BASE64 encoded right? I think I
> can figure that out but an example would be great if you have one
> handy.
>
> Is there a way to get back just the message body in plain text or am I
> going to have to parse the mime return?
>
> Thanks in advance,
> Jim

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.