automake --ignore-deps && ./configure CFLAGS="-arch ppc -arch i386" LDFLAGS="-arch ppc -arch i386" && make clean && make
//gsoap ns schema elementForm: qualifiedLikewise, when the default is unqualified, you will find
//gsoap ns schema elementForm: unqualifiedWhen an element form is qualified by default, elements in XML instances of the schema are required to be namespace qualified. Without going into too much detail, the XML basically looks like:
<x:foo xmlns:x="urn:foobar"> <x:bar>bar is qualified</x:bar> </x:foo>or:
<foo xmlns="urn:foobar"> <bar>bar is qualified</bar> </foo>When the element form is unqualified (as in SOAP RPC encoding), we would have:
<x:foo xmlns:x="urn:foobar"> <bar>bar is unqualified</bar> </x:foo>Note that sometime we can have multiple namespaces as in:
<x:foo xmlns:x="urn:foo"> <y:bar xmlns:y="urn:bar"></y:bar> </x:foo>or:
<x:foo xmlns:x="urn:foo" xmlns="urn:bar"> <bar></bar> </x:foo>In the last example the bar element belongs to the "urn:bar" namespace, because the default namespace is "urn:bar". With Visual Studio .NET 2003 WSDL import, we could not successfully deserialize data from a multi-namespace situation when a response element contains an element of struct type in a second namespace. The individual members of the struct were ignored on the .NET side until the element form default 'qualified' was defined.
The TIME_WAIT state is used to deal with possible problems related to unreliable or delayed packet delivery. TCP holds connections for a temporary waiting period (TIME_WAIT) to ensure that any delayed packets are caught and not treated as new connection requests. The size of TIME_WAIT is supposed to be twice the maximum segment lifetime or twice the time a packet can remain alive on a particular IP network. For some operating systems, this can be as high as 4 minutes. On busy systems, this can lead to a depleation of TCP port resources. Low throughput may occur due to many connections sitting in TIME_WAIT state.
The work-around is to reduce the operating system setting for TIME_WAIT substantially to the operating system minimum of 15 or 30 seconds (depending on OS).
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\ParametersSet it to a decimal value of 30 which is for 30 seconds - the minimum.
/usr/sbin/no a | grep tcp_timewaitTo set the TCP_TIMEWAIT values to 15 seconds, run the following command:
/usr/sbin/no o tcp_timewait =1The tcp_timewait option is used to configure how long connections are kept in the timewait state. It is given in 15-second intervals, and the default is 1.
/sbin/sysctl -w net.ipv4.vs.timeout_timewait=30This will set TME_WAIT for 30 seconds.
/usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 30000
void *soap_malloc(size_t n); // gSOAP 1.X void *soap_malloc(struct soap *soap, size_t n); // gSOAP 2.XThese functions allocate memory on the heap that will be released upon calling soap_end() after soap_serve(). For example, in a gSOAP service:
main()
{ ...
soap_serve(&soap);
soap_end(&soap);
...
}
An example remote method that allocates a temporary string is:
int ns__itoa(struct soap *soap, int i, char **a)
{ *a = (char*)soap_malloc(soap, 11);
sprintf(*a, "%d", i);
return SOAP_OK;
}
Note that you don't want to use local function variables to store values such as strings,
because the values are allocated on the stack and deallocated when the function returns while serialization of the values takes
place after return.
This allocation with soap_malloc() can also be used to allocate strings for the SOAP Fault data structure, for example:
int ns__mymethod(struct soap *soap, ...)
{ ...
if (exception)
{ char *message = (char*)soap_malloc(soap, 1024);
char *details = (char*)soap_malloc(soap, 1024);
sprintf(message, ...);
sprintf(details, ...);
return soap_receiver_fault(soap, message, details);
}
...
}
{ struct soap soap;
soap_init(&soap);
soap.fignore = mustmatch; // overwrite default callback
...
soap_done(&soap); // reset callbacks
}
int mustmatch(struct soap *soap, const char *tag)
{ return SOAP_TAG_MISMATCH; // every tag must be handled
}
The tag parameter contains the offending tag name. You can also selectively return a fault:
int mustmatch(struct soap *soap, const char *tag)
{ if (soap_match_tag(soap, tag, "ns:login*")) // all tags in namespace "ns" that start with "login" are optional
return SOAP_OK;
return SOAP_TAG_MISMATCH; // every other tag must be understood (handled)
}
int ns__mymethod(..., int *_return); // single anonymous output parameterand
int ns__mymethod(..., struct ns__mymethodResponse{int _return1; char *_return2; ...} *result); // multiple output paramers
extern class ostream; // can't be (de)serialized so must be declared a transient type
class ns__foo
{ public:
char *s;
struct soap *soap; // special field: already transient
ns__foo();
[ ns__foo(const char *t); // transient constructor
print(ostream &s); // transient method
]
};
with e.g. the following implementation of ns__foo:
ns__foo::ns__foo(const char *t)
{ s = (char*)soap_malloc(soap, strlen(t)+1);
strcpy(s, t);
}
The 'struct soap* soap' field in this class is a special field set by gSOAP's deserializers and the gSOAP-generated soap_new_ns__foo() function.
struct ns__data { ... };
int ns__example(..., struct ns__data *out);
where the ns__data struct contains the result parameters of the
method. The struct is translated into an element definition in the generated WSDL to
support doc/lit style messaging. As you can see, this means that ns__data cannot be
used as a type anywhere else in your header file. To work around this problem,
use:
struct ns__data { ... };
int ns__example(..., struct ns__exampleResponse { struct ns__data out; } *out);
Now we have a type ns__data and a response struct for the method
results.
typedef char *XML;or
typedef wchar_t *XML;and use either XML type for mixed-content strings (strings that contain XML).