|
Hello
I found this page: http://msdn.microsoft.com/es-es/library/8728chd5.aspx
I want to get the user name and the password in the web service but I can not.
Anyone knows how can I do it? These are my files:
***********************************************************************
***********************************************************************
MyWebService.asmx.vb
***********************************************************************
***********************************************************************
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' Define a SOAP header by deriving from the SoapHeader base class.
Public Class MyHeader : Inherits SoapHeader
Public Username As String
Public Password As String
End Class
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class MyWebService
' Add a member variable of the type deriving from SoapHeader.
Public myHeaderMemberVariable As MyHeader
' Apply a SoapHeader attribute.
<WebMethod(), SoapHeader("myHeaderMemberVariable")> _
Public Function MyWebMethod() As String
' Process the SoapHeader.
Return myHeaderMemberVariable.Username
End Function
End Class
***********************************************************************
***********************************************************************
test1.php
***********************************************************************
***********************************************************************
<?php
require_once('nusoap_0-7-3/lib/nusoap.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Probando los Web Services desde PHP</title>
</head>
<body>
<?php
$wsdl = 'http://localhost/ws/MyWebService.asmx?WSDL';
$method = 'MyWebMethod';
$params = array();
$client = new nusoap_client($wsdl, 'wsdl');
//$client->response_timeout = 600;
$client->soap_defencoding = 'UTF-8';
$client -> setHeaders('
<MyHeader>
<Username>myUserName</Username>
<Password>myPassword</Password>
</MyHeader>
');
$err = $client->getError();
//echo "<br/> proxyport =".htmlspecialchars($client->$proxyhost)."<br/>";
if ($err) {
echo '<h2>Error del contructor</h2><pre>' . $err . '</pre>';
echo '<h2>Debug:</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
exit();
}
$result = $client->call($method, $params);
if ($client->fault) {
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
?>
</body>
</html>
***********************************************************************
***********************************************************************
The error:
***********************************************************************
***********************************************************************
Fault
Array
(
[faultcode] => soap:Server
[faultstring] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at meals_ws_application.MyWebService.MyWebMethod() in C:\Documents and Settings\ingenieria\Mis documentos\Visual Studio 10\Projects\ws\meals-ws-application\MyWebService.asmx.vb:line 25
--- End of inner exception stack trace ---
[detail] =>
)
Request
POST /ws/MyWebService.asmx HTTP/1.0
Host: localhost
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://tempuri.org/MyWebMethod"
Content-Length: 554
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4181="http://tempuri.org"><SOAP-ENV:Header>
<MyHeader>
<Username>Admin</Username>
<Password>contrasenia</Password>
</MyHeader>
</SOAP-ENV:Header><SOAP-ENV:Body><MyWebMethod xmlns="http://tempuri.org/"></MyWebMethod></SOAP-ENV:Body></SOAP-ENV:Envelope>
Thanks for your help.
|
|
|
|
|
Hi every one
I used an image control on a web page.The image is shown in design time but not in runtime.The ImageUrl is "~/Images/bg.jpg".
I tried other formats like "./Images/bg.jpg" or "F:/myWebSite/Images/bg.jpg" but no success.
any idea?
thanks
|
|
|
|
|
Does your image folder contain web.config file?
|
|
|
|
|
No , there is no config file in "Images" folder.
|
|
|
|
|
Can you access the images by URL in a browser?
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Yes ,I can access the image by url "f:\WebSite2\Images\bg.jpg " in browser.
|
|
|
|
|
Hello,
I need to know this one. How can we get printer status using JavaScript and also how can we give MS word document print command using JavaScript.
Thank you,
Gokul Rangarajan
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/aa394363%28v=VS.85%29.aspx[^]
Refer this one
Sample code is
string printerName ="HP LaserJet M1522 MFP Series PCL 6 (Copy 1)"; // this is my printer name
memoPrintDetail.Clear(); //memoPrintDetail is richTextBox to show my complete printer status later on
memoPrintDetail.AppendText("Printer Name : " + printerName + "\n");
ManagementScope scope = new ManagementScope(@"\root\cimv2");
scope.Connect();
// Select All Printers from my computer
ManagementObjectSearcher searcher = new
ManagementObjectSearcher("SELECT * FROM Win32_Printer");
ManagementObjectCollection collection = searcher.Get();
string filename="text1.txt";
File.WriteAllText(filename,"");
//File.Create("text1.txt");
foreach (ManagementObject printer in collection)
{
//if (printer["Default"].ToString().ToLower().Equals("true"))
//{
// printerName = printer["Name"].ToString();
//}
//else
//{
// continue;
//}
if (printer["Name"].ToString() == printerName)
{
if (printer["WorkOffline"].ToString().ToLower().Equals("true")) // This code is working
{
memoPrintDetail.AppendText("Status : Offline\n");// This code is working
return;
}
else
{
memoPrintDetail.AppendText("Status : Online\n");// This code is working
}
//MessageBox.Show(printer["ExtendedDetectedErrorState"].ToString()); // Always show "0" value
// MessageBox.Show(printer["DetectedErrorState"].ToString()); // Always show "0" value
foreach (PropertyData pdata in printer.Properties)
{
File.AppendAllText(filename, "\r\nName: " + pdata.Name);
File.AppendAllText(filename, "\r\nValue: " + pdata.Value);
memoPrintDetail.AppendText("\nName" + pdata.Name);
memoPrintDetail.AppendText("\nValue" + pdata.Value);
}
}
}
Note::
----------
memoPrintDetail is a rich textbox
suriya
|
|
|
|
|
Hello,
This is Gokul Rangarajan. I need a suggestion or code in JavaScript which reads the MS Word document page settings and number of pages. I know how to open and read a MS Word document, but i couldn't able to get page properties. Some one please help me with this.
Thank you,
Gokul Rangarajan
|
|
|
|
|
Hello,
It Gokul again. I found the solution for my problem i've posted
var w=new ActiveXObject('Word.Application'); --creare MS word obj.
w.Documents.Open("C:\\ABSTRACT.doc"); -- open a doc..
obj=w.visible=false; --- set visible false
obj.Content; --- to get content in MS word doc..
w.ActiveDocument.ComputeStatistics(2); -- Get number of pages
w.ActiveDocument.ActiveWindow.Panes(1).Pages.Item(1).Width; -get width in pixels..
w.ActiveDocument.ActiveWindow.Panes(1).Pages.Item(1).Height; -get height in pixels..
w.ActiveDocument.PageSetup.TopMargin --get Margin top in pixels
w.ActiveDocument.PageSetup.LeftMargin --get Margin left in pixels
w.ActiveDocument.PageSetup.BottomMargin --get Margin bottom in pixels
w.ActiveDocument.PageSetup.RightMargin --get Margin right in pixels
w.ActiveDocument.PrintOut(); //Print given document
Note: 72 pixel = 1 inches.
Thank you,
Gokul Rangarajan
|
|
|
|
|
Dear friend,
I have hosted 3 web sites (WebSite1, WebSite2 ,WebSite3) on IIS6.0.
I want to kill process of website2 in c# while killing the process of Web Site 2 ,the other website like website1 and website3 should not be stopped .First of all I am very eager to know how to get process of specific website so that I can kill process individually.WebSite1 , WebSite2 and Website 3 is not in default website . These are created separately.
Please let me know how to kill process of specific website.
Regards
Rajesh
rajesh
|
|
|
|
|
Hi,
do you host every website in a different application pool? If yes, then you can kill a website by killing the process for the app-pool. I know there is a command-line tool to get the name of the process running a single application pool, so I guess this is also possible using WMI or something similar.
Regards
Sebastian
|
|
|
|
|
Hi
i am using vb script in my client side and i have to send a byte array from this client side to server side(may be iis).
at present i am just converting this byte array into string and send thro hidden field.
but i need to send the byte array directly(without any conversion).
hope i'll get quick reply.
thanks
regards
subramanian
|
|
|
|
|
I want to disable print screen on the webpage.
I have tried the option of Clearing the Clipboard after regular interval, issue with this is, it also clears the text data from clipboard
I want to disable only the print screen, whereas user can copy/paste the text data from other windows
|
|
|
|
|
I am writing a winform application that allows the user to define a range in a HTML document by selecting two anchor points: beginning and end. I'd like to graphically display the selected range by programattically inserting HTML into the in-memory version of the HTML, which should then render in my WebBrowser control. Ideally, I'd like to draw a box around the selected range, maybe with a nice colored background. Unfortunately, the beginning and ending anchor points may not reside in the same HTML block, and I'm not sure how to write the HTML to make a box span HTML blocks like that.
Clear as mud? Any thoughts or ideas would be appreciated.
Aaron
|
|
|
|
|
I'm working on making tables look nice in CSS, but I'm running into some difficulties:
If I do
td.TD2
{
padding:5px;
}
then I get a class for a single cell with the padding space that I want. However, applying the padding property to a tr class or a table class appears to do nothing.
Anyway, I'd rather not specify a new class for every single td on the page. Is there an elegant way to make the padding property work for an entire table?
|
|
|
|
|
table.T2 td
{
padding:5px;
}
Funny how I tend to figure out the answer to my own question the second after finally resorting to posting on the forum.
|
|
|
|
|
(edit: crap, it's in the web forum, wanted to put that in the lounge... possible to move it ?)
Howdy'
Dad wants to have his own presence on the web.
His main use will be to publish fiction and non-fiction texts, articles and stuff like that.
His main requirements are that the layout be as simple as possible (NOT myspace-ish) and that it should be as easy as possible to manage his "site";he also wants to have a domain registered to his name.
I'm pushing him towards blog engine like wordpress or typepad.
Comments ? suggestions ?
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
Blogspot is a good choice too. If you know html and css, you can change the design to your own.
|
|
|
|
|
Anyone telling you the "best" will be giving their opinion, there is no objective winner. I use blogger.com, but wordpress.com and livejournal.com are also popular.
|
|
|
|
|
Hi All,
I just want to know which is the best way to retract user of a web page from saving the images displayed in webpage.
The ways I know are
Disable rightclick save image using javascript
Using transparent image in from of the image.
Using flash.
Can anyone suggest the best method for this?
Thanks
|
|
|
|
|
If you want greatest security(of images ), use flash.
But if you want your site to be compatible as well, then choose 2nd way.
Using flash would be more secure, but not everybody's browser has flash installed.
Therefore I would choose 2nd way.
|
|
|
|
|
Well Yes - We can't expect to have flash on all machines.
Though even if I use second method, the images will be present in the temporary internet file folder.
Any thoughts??
|
|
|
|
|
That's the way the internet/browsers work.
You put a picture up on a web page then be prepared for the fact that every person that views your picture now has it stored on their own hard drive.
Don't want them to have it don't put it on the internet.
|
|
|
|
|
hi all
i'm new to web services
i've uploaded my web service files to a remote ftp
in the add web reference window when I try to select my file I get in the 'web service found at this URL'
the following message: 'Default credentials are not supported on an FTP request.
Parameter name: value '
what does it means?
what should I do?
Thanks
|
|
|
|