cancel
Showing results for 
Search instead for 
Did you mean: 

Web Api Soap: how to display in the element response name the _ (underscore)

Highlighted

Web Api Soap: how to display in the element response name the _ (underscore)

Hi all,

I'm trying to display in the response an element with the underscore character, but I can't (i'm getting an error).

 

For example I should have <increment_id>123456</increment_id>

 

Following is my situation:

this is the interface and i must have in the response the element 

<?php
 
namespace Sibyl\Ctm\Api\Data;
 
 
interface SibylDataOrder2Interface
{
	
	/**
     * Get value
     * 
     * @return string
     */
    public function getIncrement_Id();
	
	/**
     * Return value
     * 
     * @return void
     */
	public function setIncrement_Id(String $temp);


......
?>

and here the class implementing the previous interface

 

<?php
 
 
// app/code/local/Sibyl/Ctm/Model/Order/SibylDataOrder2.php
namespace Sibyl\Ctm\Model\Order;
 
 
class SibylDataOrder2 implements \Sibyl\Ctm\Api\Data\SibylDataOrder2Interface{
 
    public $increment_Id;
	
 	public function getIncrement_Id(){
		return $this->increment_Id;
	}
	
	public function setIncrement_Id(String $temp){
		$this->increment_Id = $temp;
	}


.....
?>

When i call the service i get this error message:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: object has no 'increment_Id' property</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
{"messages":{"error":[{"code":500,"message":"Server internal error. See details in report api\/1549231960746"}]}}                                                            

 

But if i remove the _  (underscore) from methods (get and set) and variable increment_Id service working fine.

 

 

Can anyone help me?

 

Thanks in advance