Solved

Problem with php and MM7 protocol (soap)

Posted on 2004-10-15
8
4,635 Views
Last Modified: 2008-03-06
Hi all,
I have a big issue since around 10 days, I'm stuck.
I need to send SOAP to an MMSC (multimedia message service connectivity) server using mm7 protocol.
Protocol is defined by 3gpp
docs here:
http://www.nowsms.com/documentation/ProductDocumentation/mms_notifications_and_content/Submitting_MMS_Messages_MM7.htm
and
http://www.3gpp.org/ftp/Specs/html-info/23140.htm
http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/23140-670.zip

I always got the same error, as I'm a little bit new in the SOAP stuff, I'd like some help:
here is my php code:

<?
require_once('nusoap.php');

$wsdl = 'http://16179433222:reicherV@edev.openwave.com:8080/mm7';

$namespace= 'http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3';

$client = new soapclient($wsdl);

$header = '<mm7:TransactionID xmlns:mm7='".$namespace.'">ID_1234</mm7:TransactionID>';

$soapmsg= $client->serializeEnvelope('
<SubmitReq>
<MM7Version>5.3.0</MM7Version>
        <SenderIdentification>
<VASPID>my id</VASPID>
</SenderIdentification>
        <Recipients>
        <To>
<Number>16507433992</Number>
</To>
</Recipients>
<MessageClass>Personal</MessageClass>
<ExpiryDate>2004-10-15T11:28:37-07:00</ExpiryDate>
<DeliveryReport>true</DeliveryReport>
<Priority>Low</Priority>
<Subject>Attachments you wanted...</Subject>
<DistributionIndicator>true</DistributionIndicator>
<Content href="cid:generic_content_id"/>
</SubmitReq>',$header,$namespace);

$response = $client->send($soapmsg);

$err = $client->getError();
if ($err) {
    echo '<p><b>Constructor error: ' . $err . '</b></p>';
}

$client->debug_flag=true;

echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>


the answer is very 'bad' as the openwave server answers "error parsing soap envelope"
Here is the communication log between the client and the server:


Request

POST /mm7 HTTP/1.0
Host: edev.openwave.com:8080
Authorization: Basic MTYxNzk0MzMyMjI6cmVpY2hlclY=
User-Agent: NuSOAP/1.69 (1.80)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 797

<?xml version="1.0"><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><mm7:TransactionID xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3">ID_1234</mm7:TransactionID></env:Header><env:Body>
<SubmitReq>
<MM7Version>5.3.0</MM7Version>
      <SenderIdentification>
<VASPID>my id</VASPID>
</SenderIdentification>
      <Recipients>
      <To>
<Number>16507433992</Number>
</To>
</Recipients>
<MessageClass>Personal</MessageClass>
<ExpiryDate>2004-10-15T11:28:37-07:00</ExpiryDate>
<DeliveryReport>true</DeliveryReport>
<ReadReply>true</ReadReply>
<Priority>Low</Priority>
<Subject>Attachments you wanted...</Subject>
<DistributionIndicator>true</DistributionIndicator>
<Content href="cid:generic_content_id"/>
</SubmitReq></env:Body></env:Envelope>

Response

HTTP/1.1 200 OK
Content-length: 681
Content-type: text/xml
Connection: close

<?xml version='1.0' ?>
<E:Envelope xmlns:E="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.w3.org/2001/XMLSchema">
<E:Header>
<ns1:TransactionID xmlns:ns1="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0">
bd928a:ff2adf2e89:-8000openwave-pq71lw/10.20.5.131
</ns1:TransactionID>
</E:Header>
<E:Body><E:Fault>
<faultcode>Client</faultcode>
<faultstring>error parsing soap envelope</faultstring>
<detail><RSErrorRsp>
<MM7Version>5.3.0</MM7Version>
<Status>
<StatusCode>4004</StatusCode>
<StatusText>error parsing soap envelope</StatusText>
</Status>
</RSErrorRsp></detail>
</E:Fault>
</E:Body>
</E:Envelope>

Debug

2004-10-15 21:36:00.820522 soapclient: transporting via HTTP
2004-10-15 21:36:00.822512 soapclient: sending message, length: 797
2004-10-15 21:36:00.820967 soap_transport_http: scheme = http
2004-10-15 21:36:00.821138 soap_transport_http: host = edev.openwave.com
2004-10-15 21:36:00.821277 soap_transport_http: port = 8080
2004-10-15 21:36:00.821405 soap_transport_http: user = 16179433222
2004-10-15 21:36:00.821530 soap_transport_http: pass = reicherV
2004-10-15 21:36:00.821667 soap_transport_http: path = /mm7
2004-10-15 21:36:00.821951 soap_transport_http: Set credentials for authtype basic
2004-10-15 21:36:00.822175 soap_transport_http: Authorization header set: Basic MTYxNz...
2004-10-15 21:36:00.822721 soap_transport_http: entered send() with data of length: 797
2004-10-15 21:36:00.822931 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme http, host edev.openwave.com, port 8080
2004-10-15 21:36:00.823086 soap_transport_http: calling fsockopen with host edev.openwave.com
2004-10-15 21:36:00.927452 soap_transport_http: socket connected
2004-10-15 21:36:00.927597 soap_transport_http: HTTP request: POST /mm7 HTTP/1.0
2004-10-15 21:36:00.927665 soap_transport_http: HTTP header: Host: edev.openwave.com:8080
2004-10-15 21:36:00.927727 soap_transport_http: HTTP header: Authorization: Basic MTYxNzk0MzMyMjI6cmVpY2hlclY=
2004-10-15 21:36:00.927790 soap_transport_http: HTTP header: User-Agent: NuSOAP/1.69 (1.80)
2004-10-15 21:36:00.927850 soap_transport_http: HTTP header: Content-Type: text/xml; charset=ISO-8859-1
2004-10-15 21:36:00.927910 soap_transport_http: HTTP header: SOAPAction: ""
2004-10-15 21:36:00.927972 soap_transport_http: HTTP header: Content-Length: 797
2004-10-15 21:36:00.928068 soap_transport_http: wrote data to socket, length = 1013
2004-10-15 21:36:01.273677 soap_transport_http: read line of 17 bytes: HTTP/1.1 200 OK
2004-10-15 21:36:01.273803 soap_transport_http: read line of 21 bytes: Content-length: 681
2004-10-15 21:36:01.273878 soap_transport_http: read line of 24 bytes: Content-type: text/xml
2004-10-15 21:36:01.273952 soap_transport_http: read line of 19 bytes: Connection: close
2004-10-15 21:36:01.274024 soap_transport_http: read line of 2 bytes:
2004-10-15 21:36:01.274124 soap_transport_http: found end of headers after length 83
2004-10-15 21:36:01.274277 soap_transport_http: want to read content of length 681
2004-10-15 21:36:01.274355 soap_transport_http: read buffer of 681 bytes
2004-10-15 21:36:01.274425 soap_transport_http: read to EOF
2004-10-15 21:36:01.274481 soap_transport_http: read body of length 681
2004-10-15 21:36:01.274540 soap_transport_http: received a total of 764 bytes of data from server
2004-10-15 21:36:01.274636 soap_transport_http: closed socket
2004-10-15 21:36:01.274719 soap_transport_http: No Content-Encoding header
2004-10-15 21:36:01.274786 soap_transport_http: end of send()
2004-10-15 21:36:01.274891 soapclient: got response, length: 681 type: text/xml
2004-10-15 21:36:01.274958 soapclient: Entering parseResponse() for data of length 681 and type text/xml
2004-10-15 21:36:01.275023 soapclient: Use encoding: ISO-8859-1 when creating soap_parser
2004-10-15 21:36:01.275199 soap_parser: No encoding specified in XML declaration
2004-10-15 21:36:01.275261 soap_parser: Entering soap_parser(), length=681, encoding=ISO-8859-1
2004-10-15 21:36:01.276021 soap_parser: inside buildVal() for Header(pos 1) of type
2004-10-15 21:36:01.276271 soap_parser: found root struct Fault, pos 4
2004-10-15 21:36:01.277110 soap_parser: inside buildVal() for Status(pos 10) of type
2004-10-15 21:36:01.277270 soap_parser: inside buildVal() for RSErrorRsp(pos 8) of type
2004-10-15 21:36:01.277421 soap_parser: inside buildVal() for detail(pos 7) of type
2004-10-15 21:36:01.277569 soap_parser: inside buildVal() for Fault(pos 4) of type struct
2004-10-15 21:36:01.277760 soap_parser: parsed successfully, found root struct: 4 of name Fault

I also tried with another mmsc server (nowsms/mms) and get another answer for the exact same message:

Response

HTTP/1.0 200 OK
Content-Length: 691
Content-Type: text/xml
Connection: close

<?xml version="1.0" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
   <mm7:TransactionID xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2" env:mustUnderstand="1">
         ID_1234
   </mm7:TransactionID>
</env:Header>
<env:Body>
   <RSErrorRsp xmlns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2">
      <MM7Version>5.3.0</MM7Version>
      <Status>
            <StatusCode>4003</StatusCode>
            <StatusText>Unsupported Operation</StatusText>
            <Details>Unsupported MM7 transaction</Details>
      </Status>
   </RSErrorRsp>
</env:Body>
</env:Envelope>


So, here I am, totally ... if you have any idea, that'd be great,
thank you
0
Comment
Question by:riche127
  • 4
  • 3
8 Comments
 

Author Comment

by:riche127
ID: 12323476
small update:
I found an error in nusoap.php (I modified it slighlty to fit my needs) and now I always get the same message (for the 2 mmsc servers)
<?xml version='1.0' ?>
<E:Envelope xmlns:E="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.w3.org/2001/XMLSchema">
<E:Header>
<ns1:TransactionID xmlns:ns1="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0">
1c220eb:ff3b96dc3f:-7ffeserver165112/81.209.165.112
</ns1:TransactionID>
</E:Header>
<E:Body>
<E:Fault><faultcode>Client</faultcode>
<faultstring>unsupported operation</faultstring>
<detail>
<RSErrorRsp>
<MM7Version>5.3.0</MM7Version>
<Status><StatusCode>4003</StatusCode>
<StatusText>unsupported operation</StatusText>
<Details>unsupported operation()</Details>
</Status>
</RSErrorRsp></detail>
</E:Fault>
</E:Body>
</E:Envelope>

to find anything more, I hope you know the soap protocol better than me and that the docs will be more understandable to you
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 12324447
This usually means the SOAP body contains a request (usually the first child) that isn't defined in the WSDL, or is scoped to the wrong namespace.  In your case, it looks like your SOAP request is missing the namespace:

<SubmitReq xmlns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1 -3">
   [rest of body here]
</SubmitReq>

You have the namespace defined in the header for the transaction ID:

xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3">

but not in the body.  If the namespace was in the soap envelope, you could simply use:

<mm7:SubmitReq>

but I think it's more common to add the namespace directly to the operation element in the soap body.

Hope it helps!

Regards,
Mike Sharp  
0
 

Author Comment

by:riche127
ID: 12331134
well, as a newbie, my problem is, there is no wsdl doc for mmsc servers mm7 interface, only some docs from 3gpp I try to understand.

I read that the content-type had to be (would be better) multipart/related, so with boundaries and stuff like that.
how to change the content-type with nusoap or pear-soap ?

also I added the namespace as you said, and it doesn't change a thing.
no luck,
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:riche127
ID: 12336492
I found a wsdl for mm7 operations in nokia server sdk.
Now, how can I use it to create my client, as the service is on the net, and the wsdl local ?

Also, docs say it's better to use multipart/related type for the webservice.

How to specify that the http connection has to be multipart/related ??

thank you
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 12339660
Well, I don't know specifically how to set it with nusoap or pear soap, as I've never used those, but multipart/related is a MIME type, and in your case it basically means "SOAP with Attachements".  The idea is that a message may be made up of several parts, but each part does not make sense except in the context of the other parts.  It goes like this:

Soap message
Attachment 1
Attachment 2
etc.

The SOAP message isn't useful without the attachments (which usually carry some sort of information or resource that's important to the entire request).  Originally SOAP didn't support this, and protocols like ebXML had to develop their own messaging architecture.  Later, pressure from these groups encourages SOAP to support it.

You can find the MIME spec for multipart/related in RFC2387 (a good concise explanation is at http://www.faqs.org/rfcs/rfc2387.html).

SOAP with Attachments is at:  http://www.w3.org/TR/SOAP-attachments

An excellent description of how this works can be found on the National Institutes of Health website at:
http://era.nih.gov/Projectmgmt/SBIR/soap_message_mime.htm



Basically all you do is set the content-type of the request header to multipart/related, then construct the message.  The message is the MIME envelope, which contains several sections.  It starts with a MIME header that defines several things.  

1. Which part contains the message header ("header", which is the SOAP message, in this case)
2. What the content-type of the message header is (text/xml, in this case)
3. What string is used to mark the boundaries of each part in the MIME envelope ("myBoundary")
4. and a content-type specification, that should match what you've set in the HTTP header.  

Each part of the message might contain a Content-id. An example of a message is:

Content-Type: multipart/related; type = "text/xml"; boundary="myBoundary"; start=header

--myBoundary
Content-Type: text/xml
Content-Id: <header>

SOAP Message goes here

--myBoundary
Content-Type: video/mpeg
Content-Id: <attachement1>

Some sort of attachment goes here.  Maybe an MPEG video?

--myBoundary
Content-Type: application/pdf
Content-Id: <attachement2>

Maybe another attachment.  



The WSDL is basically an interface definition.  It tells you everything you need to know about what the web service is expecting.  You can think of it as a message contract.

I still think your issue revolves around the namespace...but you can try the multipart route as well.  Are you trying to send any attachmments?  If not, I don't see why enclosing the SOAP message in MIME headers would get you anything--unless their service can't handle anything else.

It may also be the service is expecting a compressed message.  The debug message said there was no Content-encoding header, which would be where the client compresses the content, then specifies it used, for example, gzip.


Regards,
Mike Sharp
0
 

Author Comment

by:riche127
ID: 12363798
thank you for this, that really helped a lot.
now it seems I need to get a level higher in soap attachment:

"MM7 requests that carry a SOAP attachment shall have a
“multipart/related” [RFC2387] Content-Type. The SOAP envelope shall be
the first part of the MIME message and shall be indicated by the Start
parameter of the multipart/related Content-Type. If a SOAP attachment
is included it shall be encoded as a MIME part and shall be the second
part of the HTTP Post message. The MIME part should have the
appropriate content type(s) to identify the payload."

Meaning that my soap message has to be multipart/related and the attachment part as to be to be multipart/related too, to include all different files.
Any idea ?
0
 
LVL 26

Accepted Solution

by:
rdcpro earned 500 total points
ID: 12364264
No, the attachment is whatever MIME type it is...like "application/pdf" "video/mpeg" etc.  

There is the MIME headers themselves.  These are multipart/related.  This is the header:

Content-Type: multipart/related; type = "text/xml"; boundary="myBoundary"; start=header

Then there is each part.  The first part contains the SOAP message, identified by the MIME boundary, and has a Content-Type of text/xml:

--myBoundary
Content-Type: text/xml
Content-Id: <header>

SOAP Message goes here

Then your attachments, if any, follow--separated by the MIME boundary.  Each one must have a Content-Type that reflects the actual thing that is in the attachement:

--myBoundary
Content-Type: video/mpeg
Content-Id: <attachement1>

Some sort of attachment goes here.  Maybe an MPEG video?

--myBoundary
Content-Type: application/pdf
Content-Id: <attachement2>

Maybe another attachment.  



Regards,
Mike Sharp
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now