how to write code for web services in php












-3















I have a code manual for web services in ASP.net. I want to write same code in PHP for web services. This is the first time I am trying. Please help me.



I have written the following .net code:



try
{

Europaeiske.eCommercePrivate service = new Europaeiske.eCommercePrivate();
Service.Url =“http://test.webs.europaeiske.dk/IntegrationServices/ecommerceprivateservice.asmx”;
Europaeiske.SecurityToken token = service.Login(“123456”, “password”);
service.SecurityTokenValue = token;
string ProductCode = “TEST”;
Europaeiske.TripData tripData = new Europaeiske.TripData();
tripData.GeographicalZone = "EUR";
Europaeiske.ResponseProductTerms resProductTerms;
resProductTerms = service.ProductTerms(ProductCode, tripData);
Version 2.8 Page 12 of 26
lblResult.Text = BuildResult(resProductTerms);
}
catch (System.Web.Services.Protocols.SoapException soapException)
{
string message = “ERROR: “ + soapException.Message;

if (soapException.InnerException != null)
{
message += “ (“ + soapException.InnerException.Message + “)”;
}
lblResult.Text = message;
}


Following request and response code is provided in the code manual that I am following:



Request:



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<SecurityToken xmlns="http://webs.europaeiske.dk">
<Token>string</Token>
</SecurityToken>
</soap:Header>
<soap:Body>
<ProductTerms xmlns="http://webs.europaeiske.dk">
<productCode>string</productCode>
<tripData>
<StartDate>string</StartDate>
<EndDate>string</EndDate>
<TripType>string</TripType>
<GeographicalZone>string</GeographicalZone>
<DestinationList>
<string>string</string>
<string>string</string>
</DestinationList>
</tripData>
</ProductTerms>
</soap:Body>
</soap:Envelope>


Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProductTermsResponse xmlns="http://webs.europaeiske.dk">
<ProductTermsResult>
<ProductCode>string</ProductCode>
<ProductName>string</ProductName>
<ProductDescription>string</ProductDescription>
<ProductDescriptions>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
</ProductDescriptions>
<URL>string</URL>
<ProductKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
</ProductKnowledge>
</ProductTermsResult>
</ProductTermsResponse>
</soap:Body>
</soap:Envelope>


Source URL:
Test: https://testtiwi.europaeiske.dk/ecommerceprivateservice.asmx?wsdl



With the provided information, how to write a web service in PHP?










share|improve this question























  • Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

    – Clive
    14 hours ago











  • I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

    – Rashmi
    14 hours ago








  • 1





    You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

    – Clive
    14 hours ago
















-3















I have a code manual for web services in ASP.net. I want to write same code in PHP for web services. This is the first time I am trying. Please help me.



I have written the following .net code:



try
{

Europaeiske.eCommercePrivate service = new Europaeiske.eCommercePrivate();
Service.Url =“http://test.webs.europaeiske.dk/IntegrationServices/ecommerceprivateservice.asmx”;
Europaeiske.SecurityToken token = service.Login(“123456”, “password”);
service.SecurityTokenValue = token;
string ProductCode = “TEST”;
Europaeiske.TripData tripData = new Europaeiske.TripData();
tripData.GeographicalZone = "EUR";
Europaeiske.ResponseProductTerms resProductTerms;
resProductTerms = service.ProductTerms(ProductCode, tripData);
Version 2.8 Page 12 of 26
lblResult.Text = BuildResult(resProductTerms);
}
catch (System.Web.Services.Protocols.SoapException soapException)
{
string message = “ERROR: “ + soapException.Message;

if (soapException.InnerException != null)
{
message += “ (“ + soapException.InnerException.Message + “)”;
}
lblResult.Text = message;
}


Following request and response code is provided in the code manual that I am following:



Request:



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<SecurityToken xmlns="http://webs.europaeiske.dk">
<Token>string</Token>
</SecurityToken>
</soap:Header>
<soap:Body>
<ProductTerms xmlns="http://webs.europaeiske.dk">
<productCode>string</productCode>
<tripData>
<StartDate>string</StartDate>
<EndDate>string</EndDate>
<TripType>string</TripType>
<GeographicalZone>string</GeographicalZone>
<DestinationList>
<string>string</string>
<string>string</string>
</DestinationList>
</tripData>
</ProductTerms>
</soap:Body>
</soap:Envelope>


Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProductTermsResponse xmlns="http://webs.europaeiske.dk">
<ProductTermsResult>
<ProductCode>string</ProductCode>
<ProductName>string</ProductName>
<ProductDescription>string</ProductDescription>
<ProductDescriptions>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
</ProductDescriptions>
<URL>string</URL>
<ProductKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
</ProductKnowledge>
</ProductTermsResult>
</ProductTermsResponse>
</soap:Body>
</soap:Envelope>


Source URL:
Test: https://testtiwi.europaeiske.dk/ecommerceprivateservice.asmx?wsdl



With the provided information, how to write a web service in PHP?










share|improve this question























  • Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

    – Clive
    14 hours ago











  • I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

    – Rashmi
    14 hours ago








  • 1





    You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

    – Clive
    14 hours ago














-3












-3








-3








I have a code manual for web services in ASP.net. I want to write same code in PHP for web services. This is the first time I am trying. Please help me.



I have written the following .net code:



try
{

Europaeiske.eCommercePrivate service = new Europaeiske.eCommercePrivate();
Service.Url =“http://test.webs.europaeiske.dk/IntegrationServices/ecommerceprivateservice.asmx”;
Europaeiske.SecurityToken token = service.Login(“123456”, “password”);
service.SecurityTokenValue = token;
string ProductCode = “TEST”;
Europaeiske.TripData tripData = new Europaeiske.TripData();
tripData.GeographicalZone = "EUR";
Europaeiske.ResponseProductTerms resProductTerms;
resProductTerms = service.ProductTerms(ProductCode, tripData);
Version 2.8 Page 12 of 26
lblResult.Text = BuildResult(resProductTerms);
}
catch (System.Web.Services.Protocols.SoapException soapException)
{
string message = “ERROR: “ + soapException.Message;

if (soapException.InnerException != null)
{
message += “ (“ + soapException.InnerException.Message + “)”;
}
lblResult.Text = message;
}


Following request and response code is provided in the code manual that I am following:



Request:



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<SecurityToken xmlns="http://webs.europaeiske.dk">
<Token>string</Token>
</SecurityToken>
</soap:Header>
<soap:Body>
<ProductTerms xmlns="http://webs.europaeiske.dk">
<productCode>string</productCode>
<tripData>
<StartDate>string</StartDate>
<EndDate>string</EndDate>
<TripType>string</TripType>
<GeographicalZone>string</GeographicalZone>
<DestinationList>
<string>string</string>
<string>string</string>
</DestinationList>
</tripData>
</ProductTerms>
</soap:Body>
</soap:Envelope>


Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProductTermsResponse xmlns="http://webs.europaeiske.dk">
<ProductTermsResult>
<ProductCode>string</ProductCode>
<ProductName>string</ProductName>
<ProductDescription>string</ProductDescription>
<ProductDescriptions>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
</ProductDescriptions>
<URL>string</URL>
<ProductKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
</ProductKnowledge>
</ProductTermsResult>
</ProductTermsResponse>
</soap:Body>
</soap:Envelope>


Source URL:
Test: https://testtiwi.europaeiske.dk/ecommerceprivateservice.asmx?wsdl



With the provided information, how to write a web service in PHP?










share|improve this question














I have a code manual for web services in ASP.net. I want to write same code in PHP for web services. This is the first time I am trying. Please help me.



I have written the following .net code:



try
{

Europaeiske.eCommercePrivate service = new Europaeiske.eCommercePrivate();
Service.Url =“http://test.webs.europaeiske.dk/IntegrationServices/ecommerceprivateservice.asmx”;
Europaeiske.SecurityToken token = service.Login(“123456”, “password”);
service.SecurityTokenValue = token;
string ProductCode = “TEST”;
Europaeiske.TripData tripData = new Europaeiske.TripData();
tripData.GeographicalZone = "EUR";
Europaeiske.ResponseProductTerms resProductTerms;
resProductTerms = service.ProductTerms(ProductCode, tripData);
Version 2.8 Page 12 of 26
lblResult.Text = BuildResult(resProductTerms);
}
catch (System.Web.Services.Protocols.SoapException soapException)
{
string message = “ERROR: “ + soapException.Message;

if (soapException.InnerException != null)
{
message += “ (“ + soapException.InnerException.Message + “)”;
}
lblResult.Text = message;
}


Following request and response code is provided in the code manual that I am following:



Request:



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<SecurityToken xmlns="http://webs.europaeiske.dk">
<Token>string</Token>
</SecurityToken>
</soap:Header>
<soap:Body>
<ProductTerms xmlns="http://webs.europaeiske.dk">
<productCode>string</productCode>
<tripData>
<StartDate>string</StartDate>
<EndDate>string</EndDate>
<TripType>string</TripType>
<GeographicalZone>string</GeographicalZone>
<DestinationList>
<string>string</string>
<string>string</string>
</DestinationList>
</tripData>
</ProductTerms>
</soap:Body>
</soap:Envelope>


Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProductTermsResponse xmlns="http://webs.europaeiske.dk">
<ProductTermsResult>
<ProductCode>string</ProductCode>
<ProductName>string</ProductName>
<ProductDescription>string</ProductDescription>
<ProductDescriptions>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
<InfoItem>
<Header>string</Header>
<BodyText>string</BodyText>
<Footer>string</Footer>
</InfoItem>
</ProductDescriptions>
<URL>string</URL>
<ProductKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
<FieldKnowledge>
<Usage>string</Usage>
<ID>string</ID>
<Description>string</Description>
</FieldKnowledge>
</ProductKnowledge>
</ProductTermsResult>
</ProductTermsResponse>
</soap:Body>
</soap:Envelope>


Source URL:
Test: https://testtiwi.europaeiske.dk/ecommerceprivateservice.asmx?wsdl



With the provided information, how to write a web service in PHP?







php xml






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 14 hours ago









RashmiRashmi

24




24













  • Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

    – Clive
    14 hours ago











  • I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

    – Rashmi
    14 hours ago








  • 1





    You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

    – Clive
    14 hours ago



















  • Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

    – Clive
    14 hours ago











  • I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

    – Rashmi
    14 hours ago








  • 1





    You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

    – Clive
    14 hours ago

















Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

– Clive
14 hours ago





Please post the php code you’ve tried, and describe what’s wrong with it. No one is going to write it for you

– Clive
14 hours ago













I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

– Rashmi
14 hours ago







I have tried to write a curl function i think thats not correct. Can you guide me I will write the code. You can help me with some example

– Rashmi
14 hours ago






1




1





You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

– Clive
14 hours ago





You don't really need to think, try it, then you'll know. Stack Overflow is a straight up Q+A site, you won't find someone to guide you through learning a language here.

– Clive
14 hours ago












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54250004%2fhow-to-write-code-for-web-services-in-php%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54250004%2fhow-to-write-code-for-web-services-in-php%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Liquibase includeAll doesn't find base path

How to use setInterval in EJS file?

Petrus Granier-Deferre