PHP5 the various problem solving methods that are encountered when calling JAVA WebService _php Tutorial

Source: Internet
Author: User
Tags soap switches
Start Gank.

Service side:

spring3.0.5+cxf2.4,jdk1.6

"Should be" auto-generated WSDL file <服务端不是我们的>

Client:

PHP5.1.3

The first question encountered:

Soap-error:encoding:object have no ' id ' property

But the API documentation says no ID needed to view the contents of the WSDL file

Consult the schema document for the following:

Through the schema, we can use the MaxOccurs and MinOccurs properties to define the number of times an element can occur. MaxOccurs defines the maximum number of occurrences of an element, while minOccurs defines the minimum number of occurrences of an element. The default values for MaxOccurs and minOccurs are 1! (OK, this is the service-side problem?) Then I wrote a random value, passed ... )


PS: There is a small link in the middle, I altogether to see the source code of PHP ...

The function inside the php_encoding.c in soap Model_to_xml_object

static int Model_to_xml_object (xmlnodeptr node, sdlcontentmodelptr model, zval *object, int style, int strict tsrmls_dc)

A small piece of code


} else if (model->min_occurs = = 0) {
return 2;
} else {
if (strict) {
Soap_error1 (E_error, "Encoding:object have no '%s ' property", model->u.element->name);//It's obviously it!
}
return 0;
}

I found the problem from here on the min_occurs, so it solves the above problem (is not the other side is not too normative?) )


Second question:

Looks like we got no XML document

This is depressed, solved for a long time

Has returned to the data, and then I grabbed the packet (seemingly there is a way to display the data directly), found that the returned data is similar to the following format:


http/1.1 OK
server:apache-coyote/1.1
content-type:multipart/related; Type= "Application/xop+xml"; boundary= "UUID:0C37C356-41DE-4361-9835-AB8DC023DCAC"; Start= " "; start-info= "Text/xml"
content-length:790
Date:tue, Dec 07:57:45 GMT


--uuid:0c37c356-41de-4361-9835-ab8dc023dcac
Content-type:application/xop+xml; Charset=utf-8; Type= "Text/xml";
Content-transfer-encoding:binary
Content-id:
2003 2012-12-04 15:57:46.124 Logic Error sfn004.cn: Hides stroll switches bi Feng 紝 shu ゅ cigarettes å 嶁 € wengjiang dress ki $ embroidery վ 欌 € Ã Pattaya Xuan 佹 湇 animals $ enemy Xuan 鍦-Hi æ the intestine 锛 Imperial switches energy by 啀 Rao ℃ Open kernel 岋 dev zhjx922.com: Hides stroll switches bi Feng 紝 shu ゅ cigarettes å 嶁 € wengjiang dress ki $ embroidery վ 欌 € Ã Pattaya Xuan 佹 湇 animals $ enemy Xuan 鍦-Hi æ the intestine 锛 Imperial switches energy by 啀 Rao ℃ Open kernel 岋 dev
--uuid:0c37c356-41de-4361-9835-ab8dc023dcac--
Obviously not XML. So the PHP boss has an error.

Ask the other person, the answer is:

CXF set the following upload properties, the key point is the mtom,php SOAP extension is not supported by default this thing



Baidu,google can be implemented by WSO2 WSF for PHP extension, the problem continues to find ...

Read the official documentation

Http://cn2.php.net/soap

A reply to help me solve, the final solution is as follows:

/**
* Inherit the SoapClient class, overriding the __dorequest method
* @author zhjx922
*/
Class Zsoapclient extends SoapClient
{
Public Function __dorequest ($request, $location, $action, $version, $one _way = 0)
{
$response = Parent::__dorequest ($request, $location, $action, $version, $one _way);

According to the actual situation to do treatment ... , if it is $start =strpos ($response, '
$end =strrpos ($response, ' > ');
$response _string=substr ($response, $start, $end-$start + 1);
Return ($response _string);
}
}

http://www.bkjia.com/PHPjc/371863.html www.bkjia.com true http://www.bkjia.com/PHPjc/371863.html techarticle start Gank. Server: spring3.0.5+cxf2.4,jdk1.6 should be automatically generated WSDL file service side is not our client: PHP5.1.3 met the first problem: Soap-error:enco ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.