Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6087869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:55:10+00:00 2026-05-23T11:55:10+00:00

I was trying to make a soap server in PHP and that works good,

  • 0

I was trying to make a soap server in PHP and that works good, only the wsdl requires a attribute OptIn like:

<EmailAdresses>
    <Email OptIn="true">email@domain.com</Email>
</EmailAdresses>

Is there a good php library/classes that works with attributes?
so that the Web service can return an array or something like that in a certain way and that those revenues to xml with attributes.

or how it works with the standard soap server from php ?
because good documentation is hard to find.

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:55:11+00:00Added an answer on May 23, 2026 at 11:55 am

    I’ve worked with SOAP services written in a number of languages, and I’ve never yet seen one which uses XML attributes — they always simply use XML elements with a value inside the element (either a string or further elements).

    I’m not saying you can’t use attributes, but it seems that simple name-value pairs are a better fit for the kinds of data structures that most programming languages want to work with (ie simple variables or array trees).

    But your question piqued my curiosity, so I’ve done a bit of digging for you.

    As you say, the PHP manual really doesn’t seem to be particularly forthcoming on the subject (which is unusual – it’s generally quite a good resource), but if you really want to create attributes in your SOAP XML, I did find a few snippets which might help.

    One suggestion which came up a few times was to use underscore as an array element in your data structure, and this would then become the value for the element, and other array keys would would become the attributes. Something like this:

    $mydata = array('EmailAdresses' => array(
                        'Email' => array(
                             '_' => 'email@domain.com',
                             'OptIn' => 'true')
                         )
                    );
    

    The other suggestion I found was to create it as an object rather than as an array, using PHP’s SimpleXML library, since this obviously explicitly allows the creation of XML attributes.

    Sorry I don’t have time to test those suggestions right now, but I hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a soap server with the attribute OptIn in WCF
I'm trying to make a non-WSDL call in PHP (5.2.5) like this. I'm sure
I'm trying to make a soap request and having difficulties. Here is my php:
I'm trying to use a simple wsdl file and make a soap call but
I am trying to make SOAP calls to our Exchange server using the classes
Trying to make a make generic select control that I can dynamically add elements
Trying to make a custom :confirm message for a rails form that returns data
Im trying to make a function that will return an element of type point:
I am trying to make a soap call. It's a very basic call with
I'm trying to make a sample SOAP web service using Spring-WS and JAXB and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.